Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 545605 - Adjust ecj to change in JVMS 4.7.18./19. #2625

Closed
stephan-herrmann opened this issue Jun 21, 2024 · 7 comments · Fixed by #2628
Closed

Bug 545605 - Adjust ecj to change in JVMS 4.7.18./19. #2625

stephan-herrmann opened this issue Jun 21, 2024 · 7 comments · Fixed by #2628
Assignees
Milestone

Comments

@stephan-herrmann
Copy link
Contributor

stephan-herrmann commented Jun 21, 2024

from https://bugs.eclipse.org/545605

The essence: ecj may throw in

java.lang.IllegalStateException: Mismatching number of parameter annotations, 2>1 in a(Ljava/util/function/Function;Ljava/lang/Object;J)Z in =
	at org.eclipse.jdt.internal.compiler.classfmt.MethodInfoWithParameterAnnotations.getParameterAnnotations(MethodInfoWithParameterAnnotations.java:46)
	at org.eclipse.jdt.internal.core.ClassFileInfo.generateMethodInfos(ClassFileInfo.java:364)
	at org.eclipse.jdt.internal.core.ClassFileInfo.readBinaryChildren(ClassFileInfo.java:432)

this happens when reading a class file with a method of this shape:

  // access flags 0xA
  private static a(Ljava/util/function/Function;Ljava/lang/Object;J)Z
    // annotable parameter count: 2 (invisible)
    @Lorg/jetbrains/annotations/NotNull;() // invisible, parameter 1

annotatable parameter count 2 looks "wrong", but according to the same spec sentence we are insisting on in #205, ecj should accept that classfile, whether or not we can make sense of that annotation.

@stephan-herrmann
Copy link
Contributor Author

Quite a coincidence that genie reminded me of this bug right after https://mail.openjdk.org/pipermail/compiler-dev/2024-June/026996.html ff 🪄 😄

@stephan-herrmann stephan-herrmann self-assigned this Jun 21, 2024
@srikanth-sankaran
Copy link
Contributor

What genie are you are referring to ??

@stephan-herrmann
Copy link
Contributor Author

What genie are you are referring to ??

The "author" of https://bugs.eclipse.org/bugs/show_bug.cgi?id=545605#c22, which caused an email notification two days ago.

@stephan-herrmann
Copy link
Contributor Author

The exception observed in the original bug reported was the improved diagnostic from https://bugs.eclipse.org/474081 - at which time this structure was illegal indeed.

@stephan-herrmann
Copy link
Contributor Author

Raising visibility of another link hidden in bugzilla: https://bugs.openjdk.org/browse/JDK-8067975

@stephan-herrmann
Copy link
Contributor Author

Should anybody suspect that the correlation between parameters and their annotations goes astray define a system property jdt.reject.parameterAnnotations.countMismatch=true and recompile.

@stephan-herrmann stephan-herrmann added this to the 4.33 M1 milestone Jun 23, 2024
robstryker pushed a commit to robstryker/eclipse.jdt.core that referenced this issue Jul 18, 2024
Accept class files with mismatching parameter count vis-a-vis parameter annotations (which is legal since Java 9).

Also introduces system property jdt.reject.parameterAnnotations.countMismatch to get back the previous error reporting.

fixes eclipse-jdt#2625
gayanper pushed a commit to gayanper/eclipse.jdt.core that referenced this issue Sep 7, 2024
Accept class files with mismatching parameter count vis-a-vis parameter annotations (which is legal since Java 9).

Also introduces system property jdt.reject.parameterAnnotations.countMismatch to get back the previous error reporting.

fixes eclipse-jdt#2625
@stephan-herrmann
Copy link
Contributor Author

To be continued via #2938

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants