Today I experienced another strange thig with the eclipse compiler. I coded some annotations that contain some syntax error which I wasn’t aware of since the IDE didn’t highlight it. The @@ManagedOperationParameters( { @ManagedOperationParameter(name = "category", description = "Logger category"), }) annotation is not correct, trying to compile it with the Sun compiler fails (can you spot it?).

1
2
3
4
5
 @ManagedOperation(description = "Get the logging level for a category")
  @ManagedOperationParameters( { @ManagedOperationParameter(name = "category", description = "Logger category"), })
  public String getLoggerLevel(String category) {
      return LogManager.getLogger(category).getLevel().toString();
  }

After reporting this a a eclipse JDT bug I was pointed at that this is allowed syntax (see JLS) but the sun compiler does not properly implement syntax checking! So I should rather see to report this against the Sun compiler. Still it is strange that this syntax is allowed at all!!!

Comments