سؤال

I am using STS 3.1.0 IDE and would like to write some basic Java test programs to practice object up/downcasting principles

I noticed that the IDE is automatically removing unnecessary castings, which I don't want at this point for practicing purposes, so I figured out that it should be possible to deactivate this feature, like e.g. described in this thread: Remove redundant casts in Java

I made a copy from the "Eclipse [built-in]" clean-up profile which was used by the IDE by default, unticked the "Remove unnecessary casts" checkbox, and set this copied profile active for the particular Java project. Nonetheless the IDE still keeps removing the casts. IDE restart/logout/computer restart do not seem to help either

Maybe it is some very basic issue, but I ran out of ideas so thought to post it in here. Any help is appreciated

هل كانت مفيدة؟

المحلول

Seems to have found the answer. Apparently it is not only possible to define the handling of unnecessary casts under Properties -> Java code Style -> Clean Up, but also under Properties -> Java Editor -> Save Actions. After I unticked the concerning checkbox here as well, the castings were not removed any more

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top