Some of my methods are refusing to unfold nor be debug-stepped into.

已回答

I have a few methods which IntelliJ is currently refusing to unfold within the class they belong in. 

public class ConjugateStat {  

public static <T> MutableText conjugateStat( T statSpecific, int statValue ) {
          //Set all logic variable
          int objectType = castStat(statSpecific);
          String workingTranslationKey = chooseDefaultKey(objectType, statSpecific);
          String plurality = choosePlurality(statValue);
          String irregularity = isIrregular(objectType, statSpecific, statValue);
          int article = chooseArticle(objectType, statSpecific);
          int[] genders = chooseGender(objectType, statSpecific);
...

     private static <T> int    castStat           (                    T object             ) {
          try {
               ( (Block) object ).getDefaultState().isIn(ModTags.Blocks.IS_DEFINITE); return BLOCK;
          }
          catch (ClassCastException e1) {
               try {
                    ( (Item) object ).getDefaultStack().isIn(ModTags.Items.IS_DEFINITE); return ITEM;
               }
               catch (ClassCastException e2) {
                    try {
                         ( (EntityType<?>) object ).isIn(ModTags.Entities.IS_DEFINITE); return ENTITY;
                    }
                    catch (ClassCastException e3) {
                         return -1;
                    }
               }
          }
     }
     
     private static <T> String chooseDefaultKey   ( int   objectType,  T object             ) {
          switch (objectType) {
               case BLOCK:
                    return ( (Block) object ).getTranslationKey();
               case ITEM:
                    return ( (Item) object ).getTranslationKey();
               case ENTITY:
                    return ( (EntityType<?>) object ).getTranslationKey();
               default:
                    return "";
          }
     }
     
     private static     String choosePlurality    ( int   count                             ) {
          return count == 0 ? NULL_COUNT :
               count == 1 ? SINGLE_COUNT :
                    count == 2 ? DUAL_COUNT :
                         count >= 3 ? PLURAL_COUNT :
                              NEG_COUNT;
     }
     private static <T> int    chooseArticle      ( int   objectType,  T object             ) {
          if (isIndefinite(objectType, object)) return INDEFINITE;
          if (isDefinite(objectType, object)) return DEFINITE;
          return 0;
     }
     
     private static <T> boolean isIndefinite ( int   objectType,  T object             ) {
          switch(objectType){
               case BLOCK:return((Block)object ).getDefaultState().isIn( ModTags.Blocks.IS_INDEFINITE );
               case ITEM: return((Item)object ).getDefaultStack().isIn( ModTags.Items.IS_INDEFINITE );
               case ENTITY:return((EntityType<?>)object ).isIn( ModTags.Entities.IS_INDEFINITE );
               
               default:
                    return false;
          }
     }  
}
}

When I try to unfold these methods (whether by side bar arrows, dropmenu, or attempting to edit them) in their intended context, they automatically close themselves, and wont let me access them. I noticed this problem because when trying to step into one of them while debugging, it stepped over the method instead, not letting observe more closly if it was the cause of my code not working; and I really do think my bug is in these methods.

Pasting these methods into another class allows me to unfold them in that class and make changes without issue, but pasting them back, or attempting to type them from scratch reproduces the issue.

Any ideas what's causing the problem or what I can do to fix it? I've already looked in the editor: general settings: codefolding, and tried closing and relaunching intellij. 

1

I've figured out, after a nap, that I can also get them to open by refactoring them, and re-refactoring them back force-folds them again. Something about these methods' names in this class is causing le problem?

1

A R. Hi, this seems an issue in the IDEA side instead of any configuration problem or a user error.

If you see this issue again, please share the IDE logs (idea.log) from IDE main menu `Help | Show Log in`,  share this log in https://uploads.jetbrains.com/, tell us the upload id so we could see any exception or any clues there. Thanks.

0

Hello, all of the above methods that still exist in my project are also still named ‘method_2()’ because the problem persists (renaming them back to ‘method’() force folds them).

I have uploaded my idea.log to log_ID: < 2024_04_04_27gp38dLpVQ1kDd26TAtDB  >.

I wish y'all well in bug squashing.

0
Thanks for the logs. From the exception in the log, your case is the same as https://youtrack.jetbrains.com/issue/IDEA-344488/Class-constructor-is-being-constantly-collapsed
Could you please try the 2024.1 to see if you still have this issue in that version? You can update it from `Help | Check for Updates` or download it from here: https://www.jetbrains.com/idea/download/other.html
0

Hello there. I am facing the same issue and I have just uploaded my idea.log. Update log id is Upload id: 2024_05_09_DE5zkrCWg3T6hM5HSAWirw

Thanks.

0

By the way, I have applied one of the possible fixes mentioned in the case https://youtrack.jetbrains.com/issue/IDEA-344488/Class-constructor-is-being-constantly-collapsed (remove the <project id>.xml workspace file from the IDEA config folder) and this has fixed the issue for me.

Many thanks.

0

请先登录再写评论。