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

Validate written classes if enabled, and fix reported issues #4999

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

timtebeek
Copy link
Contributor

What's changed?

When VERIFY_CLASS_WRITING was set to true, we would not validate, while we should.

What's your motivation?

Seeing downstream failures in rewrite-hibernate that had failed to replicate here

@timtebeek
Copy link
Contributor Author

Reporting the next failure here: https://ge.openrewrite.org/s/lxo3gtzucpq3c/tests/task/:rewrite-java:test/details/org.openrewrite.java.internal.parser.TypeTableTest/writeReadMicrometer()?top-execution=1
Looks like we're writing out incomplete class files; on the upside the downstream projects can use them as-is though. 🤔

java.lang.IllegalArgumentException: Execution can fall off the end of the code <init>(Ljava/lang/String;Ljava/lang/Throwable;)V	
at org.objectweb.asm.util.CheckMethodAdapter$1.throwError(CheckMethodAdapter.java:489)	
at org.objectweb.asm.util.CheckMethodAdapter$1.visitEnd(CheckMethodAdapter.java:475)	
at org.objectweb.asm.MethodVisitor.visitEnd(MethodVisitor.java:797)	
at org.objectweb.asm.util.CheckMethodAdapter.visitEnd(CheckMethodAdapter.java:1044)	
at org.openrewrite.java.internal.parser.TypeTable$Reader.lambda$writeClassesDir$3(TypeTable.java:226)	
at org.openrewrite.java.internal.parser.TypeTable$Reader$$Lambda$908/0x00007f3af0544870.accept(Unknown Source)	
at java.util.HashMap.forEach(HashMap.java:1421)	
at org.openrewrite.java.internal.parser.TypeTable$Reader.writeClassesDir(TypeTable.java:180)	
at org.openrewrite.java.internal.parser.TypeTable$Reader.read(TypeTable.java:169)	
at org.openrewrite.java.internal.parser.TypeTable.<init>(TypeTable.java:97)	
at org.openrewrite.java.internal.parser.TypeTableTest.writeReadMicrometer(TypeTableTest.java:107)	
at java.lang.reflect.Method.invoke(Method.java:569)	
at java.util.ArrayList.forEach(ArrayList.java:1511)	
at java.util.ArrayList.forEach(ArrayList.java:1511)	
Caused by: org.objectweb.asm.tree.analysis.AnalyzerException: Execution can fall off the end of the code	
at org.objectweb.asm.tree.analysis.Analyzer.findSubroutine(Analyzer.java:425)	
at org.objectweb.asm.tree.analysis.Analyzer.findSubroutines(Analyzer.java:381)	
at org.objectweb.asm.tree.analysis.Analyzer.analyze(Analyzer.java:137)	
at org.objectweb.asm.util.CheckMethodAdapter$1.visitEnd(CheckMethodAdapter.java:470)	
at org.objectweb.asm.MethodVisitor.visitEnd(MethodVisitor.java:797)	
at org.objectweb.asm.util.CheckMethodAdapter.visitEnd(CheckMethodAdapter.java:1044)	
at org.openrewrite.java.internal.parser.TypeTable$Reader.lambda$writeClassesDir$3(TypeTable.java:226)	
at org.openrewrite.java.internal.parser.TypeTable$Reader$$Lambda$908/0x00007f3af0544870.accept(Unknown Source)	
at java.util.HashMap.forEach(HashMap.java:1421)	
at org.openrewrite.java.internal.parser.TypeTable$Reader.writeClassesDir(TypeTable.java:180)	
at org.openrewrite.java.internal.parser.TypeTable$Reader.read(TypeTable.java:169)	
at org.openrewrite.java.internal.parser.TypeTable.<init>(TypeTable.java:97)	
at org.openrewrite.java.internal.parser.TypeTableTest.writeReadMicrometer(TypeTableTest.java:107)	
at java.lang.reflect.Method.invoke(Method.java:569)	
at java.util.ArrayList.forEach(ArrayList.java:1511)	
at java.util.ArrayList.forEach(ArrayList.java:1511)	

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

1 participant