You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "jcopenhop (via GitHub)" <gi...@apache.org> on 2023/02/09 00:30:19 UTC

[GitHub] [commons-bcel] jcopenhop opened a new pull request, #205: add unit test showing failure to parse class

jcopenhop opened a new pull request, #205:
URL: https://github.com/apache/commons-bcel/pull/205

   Here is a PR with a unit test that throws an exception when parsing the included class file. The class file is produced from
   ```kotlin
   class test {
       fun takeABlock(a: () -> Unit) {
           a()
       }
   
       fun `method name with () in it`() {
           takeABlock { println("other test") }
       }
   
       fun `method name without parens`() {
           takeABlock { println("other test") }
       }
   }
   ```
   
   The exception is:
   ```
   org.apache.bcel.classfile.ClassFormatException: Invalid method signature:  in it$1;
   
   	at org.apache.bcel.classfile.Utility.typeOfSignature(Utility.java:1284)
   	at org.apache.bcel.generic.Type.getType(Type.java:227)
   	at org.apache.bcel.generic.Type.getReturnType(Type.java:151)
   	at org.apache.bcel.classfile.Field.getType(Field.java:150)
   	at org.apache.bcel.classfile.InvalidMethodSigantureTestCase$TestVisitor.visitField(InvalidMethodSigantureTestCase.java:14)
   	at org.apache.bcel.classfile.Field.accept(Field.java:113)
   	at org.apache.bcel.classfile.DescendingVisitor.visitField(DescendingVisitor.java:311)
   	at org.apache.bcel.classfile.Field.accept(Field.java:113)
   	at org.apache.bcel.classfile.DescendingVisitor.lambda$accept$0(DescendingVisitor.java:44)
   	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
   	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
   	at org.apache.bcel.classfile.DescendingVisitor.accept(DescendingVisitor.java:44)
   	at org.apache.bcel.classfile.DescendingVisitor.visitJavaClass(DescendingVisitor.java:335)
   	at org.apache.bcel.classfile.JavaClass.accept(JavaClass.java:251)
   	at org.apache.bcel.classfile.DescendingVisitor.visit(DescendingVisitor.java:77)
   	at org.apache.bcel.classfile.InvalidMethodSigantureTestCase.testMethodWithParens(InvalidMethodSigantureTestCase.java:24)
   	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
   	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
   	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
   	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
   	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
   	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
   	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
   	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
   	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
   	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
   	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
   	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
   	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
   	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
   	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
   	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217)
   	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
   	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213)
   	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138)
   	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
   	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
   	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
   	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
   	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
   	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
   	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
   	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
   	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
   	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
   	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
   	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
   	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
   	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
   	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
   	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
   	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
   	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
   	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
   	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
   	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
   	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
   	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
   	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
   	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
   	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
   	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
   	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
   	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
   	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
   	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
   	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
   	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
   	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
   	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
   	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
   	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
   	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
   	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
   	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
   	at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
   	at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
   	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)
   	at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
   	at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
   	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
   	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
   	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [commons-bcel] garydgregory commented on pull request #205: add unit test showing failure to parse class

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #205:
URL: https://github.com/apache/commons-bcel/pull/205#issuecomment-1424190189

   @jcopenhop 
   Please add the missing Apache license header; see any other file for an example.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [commons-bcel] garydgregory commented on pull request #205: add unit test showing failure to parse class

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #205:
URL: https://github.com/apache/commons-bcel/pull/205#issuecomment-1445180359

   FTR, JD-GUI decompiles the class fixture as:
   ```
   import kotlin.Metadata;
   import kotlin.Unit;
   import kotlin.jvm.functions.Function0;
   import kotlin.jvm.internal.Lambda;
   
   @Metadata(mv = {1, 8, 0}, k = 3, xi = 48, d1 = {"\000\b\n\000\n\002\020\002\n\000\020\000\032\0020\001H\n\006\002\b\002"}, d2 = {"<anonymous>", "", "invoke"})
   final class test$method name with () in it$1 extends Lambda implements Function0<Unit> {
     public static final test$method name with () in it$1 INSTANCE = new test$method name with () in it$1();
     
     test$method name with () in it$1() {
       super(0);
     }
     
     public final void invoke() {
       System.out.println("other test");
     }
   }
   ```
   What VM executable can run this class file? Is it a Java VM?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [commons-bcel] jcopenhop commented on pull request #205: add unit test showing failure to parse class

Posted by "jcopenhop (via GitHub)" <gi...@apache.org>.
jcopenhop commented on PR #205:
URL: https://github.com/apache/commons-bcel/pull/205#issuecomment-1447290021

   Thanks! that fixes my local testing as well!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [commons-bcel] garydgregory closed pull request #205: add unit test showing failure to parse class

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory closed pull request #205: add unit test showing failure to parse class
URL: https://github.com/apache/commons-bcel/pull/205


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [commons-bcel] garydgregory commented on pull request #205: add unit test showing failure to parse class

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #205:
URL: https://github.com/apache/commons-bcel/pull/205#issuecomment-1445373047

   Hi @jcopenhop 
   Fixed in git master commit `28d1f9df6aa540d2830db5f7823ebf9d729ccbf3` for `6.8.0-SNAPSHOT` builds, available in https://repository.apache.org/content/repositories/snapshots/org/apache/bcel/bcel/6.8.0-SNAPSHOT
   Feel free to test and report back.
   TY!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org