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

BCEL-276 LocalVariableTypeTable is not updated when use MethodGen. #10

Closed
wants to merge 11 commits into
base: trunk
from

Conversation

Projects
None yet
2 participants
@KyongSik-Yoon

KyongSik-Yoon commented Jul 28, 2016

If a method for BCI have at least one generic type of argument JVM throw java.lang.ClassFormatError due to not updated LocalVariableTable.

I know there is workaround as call removeLocalVariables method.
But I think it's better that BCEL can stay proper LocalVariableTable.

This PR include unit test for reproduce a bug.

@britter

This comment has been minimized.

Show comment
Hide comment
@britter

britter Jul 29, 2016

Member

Hello @KyongSik-Yoon! I have applied only the LocalVariableTypeTableTest and the SimpleClassHasMethodIncludeGenericArgument class. The test passes even without your change to MethodGen.

Member

britter commented Jul 29, 2016

Hello @KyongSik-Yoon! I have applied only the LocalVariableTypeTableTest and the SimpleClassHasMethodIncludeGenericArgument class. The test passes even without your change to MethodGen.

@KyongSik-Yoon

This comment has been minimized.

Show comment
Hide comment
@KyongSik-Yoon

KyongSik-Yoon Aug 4, 2016

@britter My test case file name was incorrect.

When I saw pom.xml know that all of test case class file name should be end with TestCase.
If you run test case using maven build try modify class name to LocalVariableTypeTableTestCase then run test again using maven.

You maybe can see fail message like below.

/home/sam/java/jdk1.7.0_80/bin/java -Dmaven.home=/home/sam/bin/idea-IU-162.1121.32/plugins/maven/lib/maven3 -Dclassworlds.conf=/home/sam/bin/idea-IU-162.1121.32/plugins/maven/lib/maven3/bin/m2.conf -Didea.launcher.port=7538 -Didea.launcher.bin.path=/home/sam/bin/idea-IU-162.1121.32/bin -Dfile.encoding=UTF-8 -classpath /home/sam/bin/idea-IU-162.1121.32/plugins/maven/lib/maven3/boot/plexus-classworlds-2.4.jar:/home/sam/bin/idea-IU-162.1121.32/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=2016.2.1 test -P !jacoco
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Apache Commons BCEL 6.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven-3) @ bcel ---
[INFO]
[INFO] --- build-helper-maven-plugin:1.10:parse-version (parse-version) @ bcel ---
[INFO]
[INFO] --- maven-antrun-plugin:1.8:run (javadoc.resources) @ bcel ---
[INFO] Executing tasks

main:
[INFO] Executed tasks
[INFO]
[INFO] --- maven-remote-resources-plugin:1.5:process (default) @ bcel ---
[INFO]
[INFO] --- buildnumber-maven-plugin:1.4:create (default) @ bcel ---
[INFO] Executing: /bin/sh -c cd '/home/sam/workspace/commons-bcel' && 'svn' '--non-interactive' 'info'
[INFO] Working directory: /home/sam/workspace/commons-bcel
[INFO] Storing buildNumber: ?????? at timestamp: 1470309116175
[INFO] Executing: /bin/sh -c cd '/home/sam/workspace/commons-bcel' && 'svn' '--non-interactive' 'info'
[INFO] Working directory: /home/sam/workspace/commons-bcel
[INFO] Storing buildScmBranch: UNKNOWN_BRANCH
[INFO]
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ bcel ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/sam/workspace/commons-bcel/src/main/resources
[INFO] Copying 2 resources to META-INF
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ bcel ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-bundle-plugin:3.0.1:manifest (bundle-manifest) @ bcel ---
[INFO]
[INFO] --- animal-sniffer-maven-plugin:1.15:check (checkAPIcompatibility) @ bcel ---
[INFO] Checking unresolved references to org.codehaus.mojo.signature:java17:1.0
[INFO]
[INFO] --- maven-resources-plugin:2.7:testResources (default-testResources) @ bcel ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] Copying 2 resources to META-INF
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ bcel ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 70 source files to /home/sam/workspace/commons-bcel/target/test-classes
[INFO] /home/sam/workspace/commons-bcel/src/test/java/org/apache/bcel/LocalVariableTypeTableTestCase.java: /home/sam/workspace/commons-bcel/src/test/java/org/apache/bcel/LocalVariableTypeTableTestCase.java uses unchecked or unsafe operations.
[INFO] /home/sam/workspace/commons-bcel/src/test/java/org/apache/bcel/LocalVariableTypeTableTestCase.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ bcel ---


T E S T S

Running org.apache.bcel.ElementValueGenTestCase
Tests run: 11, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.072 sec - in org.apache.bcel.ElementValueGenTestCase
Running org.apache.bcel.PLSETestCase
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.051 sec - in org.apache.bcel.PLSETestCase
Running org.apache.bcel.EnclosingMethodAttributeTestCase
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in org.apache.bcel.EnclosingMethodAttributeTestCase
Running org.apache.bcel.AnnotationAccessFlagTestCase
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in org.apache.bcel.AnnotationAccessFlagTestCase
Running org.apache.bcel.LocalVariableTypeTableTestCase
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.001 sec <<< FAILURE! - in org.apache.bcel.LocalVariableTypeTableTestCase
testWithGenericArguement(org.apache.bcel.LocalVariableTypeTableTestCase) Time elapsed: 0.001 sec <<< ERROR!
java.lang.ClassFormatError: LVTT entry for 'a2' in class file org/apache/bcel/data/SimpleClassHasMethodIncludeGenericArgument does not match any LVT entry
at org.apache.bcel.LocalVariableTypeTableTestCase.testWithGenericArguement(LocalVariableTypeTableTestCase.java:40)

Running org.apache.bcel.InstructionFinderTestCase
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.014 sec - in org.apache.bcel.InstructionFinderTestCase
Running org.apache.bcel.AnnotationDefaultAttributeTestCase
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in org.apache.bcel.AnnotationDefaultAttributeTestCase
Running org.apache.bcel.classfile.ConstantPoolTestCase
aload_0
invokespecial java/lang/Object/()V
return
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec - in org.apache.bcel.classfile.ConstantPoolTestCase
Running org.apache.bcel.classfile.UtilityTestCase
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 sec - in org.apache.bcel.classfile.UtilityTestCase
Running org.apache.bcel.generic.FieldAnnotationsTestCase
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.008 sec - in org.apache.bcel.generic.FieldAnnotationsTestCase
Running org.apache.bcel.generic.TypeTestCase
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec - in org.apache.bcel.generic.TypeTestCase
Running org.apache.bcel.generic.AnnotationGenTestCase
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in org.apache.bcel.generic.AnnotationGenTestCase
Running org.apache.bcel.generic.JDKGenericDumpTestCase
/home/sam/java/jdk1.7.0_80/jre/lib/javaws.jar
/home/sam/java/jdk1.7.0_80/jre/lib/resources.jar
/home/sam/java/jdk1.7.0_80/jre/lib/management-agent.jar
/home/sam/java/jdk1.7.0_80/jre/lib/rt.jar
/home/sam/java/jdk1.7.0_80/jre/lib/alt-rt.jar
/home/sam/java/jdk1.7.0_80/jre/lib/jce.jar
/home/sam/java/jdk1.7.0_80/jre/lib/deploy.jar
/home/sam/java/jdk1.7.0_80/jre/lib/plugin.jar
/home/sam/java/jdk1.7.0_80/jre/lib/jfxrt.jar
/home/sam/java/jdk1.7.0_80/jre/lib/jsse.jar
/home/sam/java/jdk1.7.0_80/jre/lib/charsets.jar
/home/sam/java/jdk1.7.0_80/jre/lib/jfr.jar
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.888 sec - in org.apache.bcel.generic.JDKGenericDumpTestCase
Running org.apache.bcel.generic.InstructionHandleTestCase
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 sec - in org.apache.bcel.generic.InstructionHandleTestCase
Running org.apache.bcel.generic.BranchHandleTestCase
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 sec - in org.apache.bcel.generic.BranchHandleTestCase
Running org.apache.bcel.generic.GeneratingAnnotatedClassesTestCase
Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.025 sec - in org.apache.bcel.generic.GeneratingAnnotatedClassesTestCase
Running org.apache.bcel.generic.MethodGenTestCase
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec - in org.apache.bcel.generic.MethodGenTestCase
Running org.apache.bcel.AnonymousClassTestCase
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec - in org.apache.bcel.AnonymousClassTestCase
Running org.apache.bcel.CounterVisitorTestCase
Tests run: 37, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec - in org.apache.bcel.CounterVisitorTestCase
Running org.apache.bcel.EnumAccessFlagTestCase
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in org.apache.bcel.EnumAccessFlagTestCase
Running org.apache.bcel.PerformanceTest
parsing /home/sam/java/jdk1.7.0_80/jre/lib/javaws.jar
parsing /home/sam/java/jdk1.7.0_80/jre/lib/resources.jar
parsing /home/sam/java/jdk1.7.0_80/jre/lib/management-agent.jar
parsing /home/sam/java/jdk1.7.0_80/jre/lib/rt.jar
parsing /home/sam/java/jdk1.7.0_80/jre/lib/alt-rt.jar
parsing /home/sam/java/jdk1.7.0_80/jre/lib/jce.jar
parsing /home/sam/java/jdk1.7.0_80/jre/lib/deploy.jar
parsing /home/sam/java/jdk1.7.0_80/jre/lib/plugin.jar
parsing /home/sam/java/jdk1.7.0_80/jre/lib/jfxrt.jar
parsing /home/sam/java/jdk1.7.0_80/jre/lib/jsse.jar
parsing /home/sam/java/jdk1.7.0_80/jre/lib/charsets.jar
parsing /home/sam/java/jdk1.7.0_80/jre/lib/jfr.jar
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.92 sec - in org.apache.bcel.PerformanceTest
Running org.apache.bcel.util.Class2HTMLTestCase
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.008 sec - in org.apache.bcel.util.Class2HTMLTestCase
Running org.apache.bcel.util.BCELifierTestCase
Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0 sec - in org.apache.bcel.util.BCELifierTestCase
Running org.apache.bcel.verifier.VerifierArrayAccessTestCase
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.052 sec - in org.apache.bcel.verifier.VerifierArrayAccessTestCase
Running org.apache.bcel.verifier.VerifierReturnTestCase
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.018 sec - in org.apache.bcel.verifier.VerifierReturnTestCase
Running org.apache.bcel.verifier.VerifierInvokeTestCase
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.043 sec - in org.apache.bcel.verifier.VerifierInvokeTestCase
Running org.apache.bcel.verifier.VerifierTestCase
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in org.apache.bcel.verifier.VerifierTestCase

Results :

Tests in error:
LocalVariableTypeTableTestCase.testWithGenericArguement:40 » ClassFormat LVTT ...

Tests run: 104, Failures: 0, Errors: 1, Skipped: 1

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.684s
[INFO] Finished at: Thu Aug 04 20:12:13 KST 2016
[INFO] Final Memory: 30M/348M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project bcel: There are test failures.
[ERROR]
[ERROR] Please refer to /home/sam/workspace/commons-bcel/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Process finished with exit code 1

KyongSik-Yoon commented Aug 4, 2016

@britter My test case file name was incorrect.

When I saw pom.xml know that all of test case class file name should be end with TestCase.
If you run test case using maven build try modify class name to LocalVariableTypeTableTestCase then run test again using maven.

You maybe can see fail message like below.

/home/sam/java/jdk1.7.0_80/bin/java -Dmaven.home=/home/sam/bin/idea-IU-162.1121.32/plugins/maven/lib/maven3 -Dclassworlds.conf=/home/sam/bin/idea-IU-162.1121.32/plugins/maven/lib/maven3/bin/m2.conf -Didea.launcher.port=7538 -Didea.launcher.bin.path=/home/sam/bin/idea-IU-162.1121.32/bin -Dfile.encoding=UTF-8 -classpath /home/sam/bin/idea-IU-162.1121.32/plugins/maven/lib/maven3/boot/plexus-classworlds-2.4.jar:/home/sam/bin/idea-IU-162.1121.32/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=2016.2.1 test -P !jacoco
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Apache Commons BCEL 6.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven-3) @ bcel ---
[INFO]
[INFO] --- build-helper-maven-plugin:1.10:parse-version (parse-version) @ bcel ---
[INFO]
[INFO] --- maven-antrun-plugin:1.8:run (javadoc.resources) @ bcel ---
[INFO] Executing tasks

main:
[INFO] Executed tasks
[INFO]
[INFO] --- maven-remote-resources-plugin:1.5:process (default) @ bcel ---
[INFO]
[INFO] --- buildnumber-maven-plugin:1.4:create (default) @ bcel ---
[INFO] Executing: /bin/sh -c cd '/home/sam/workspace/commons-bcel' && 'svn' '--non-interactive' 'info'
[INFO] Working directory: /home/sam/workspace/commons-bcel
[INFO] Storing buildNumber: ?????? at timestamp: 1470309116175
[INFO] Executing: /bin/sh -c cd '/home/sam/workspace/commons-bcel' && 'svn' '--non-interactive' 'info'
[INFO] Working directory: /home/sam/workspace/commons-bcel
[INFO] Storing buildScmBranch: UNKNOWN_BRANCH
[INFO]
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ bcel ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/sam/workspace/commons-bcel/src/main/resources
[INFO] Copying 2 resources to META-INF
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ bcel ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-bundle-plugin:3.0.1:manifest (bundle-manifest) @ bcel ---
[INFO]
[INFO] --- animal-sniffer-maven-plugin:1.15:check (checkAPIcompatibility) @ bcel ---
[INFO] Checking unresolved references to org.codehaus.mojo.signature:java17:1.0
[INFO]
[INFO] --- maven-resources-plugin:2.7:testResources (default-testResources) @ bcel ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] Copying 2 resources to META-INF
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ bcel ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 70 source files to /home/sam/workspace/commons-bcel/target/test-classes
[INFO] /home/sam/workspace/commons-bcel/src/test/java/org/apache/bcel/LocalVariableTypeTableTestCase.java: /home/sam/workspace/commons-bcel/src/test/java/org/apache/bcel/LocalVariableTypeTableTestCase.java uses unchecked or unsafe operations.
[INFO] /home/sam/workspace/commons-bcel/src/test/java/org/apache/bcel/LocalVariableTypeTableTestCase.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ bcel ---


T E S T S

Running org.apache.bcel.ElementValueGenTestCase
Tests run: 11, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.072 sec - in org.apache.bcel.ElementValueGenTestCase
Running org.apache.bcel.PLSETestCase
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.051 sec - in org.apache.bcel.PLSETestCase
Running org.apache.bcel.EnclosingMethodAttributeTestCase
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in org.apache.bcel.EnclosingMethodAttributeTestCase
Running org.apache.bcel.AnnotationAccessFlagTestCase
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in org.apache.bcel.AnnotationAccessFlagTestCase
Running org.apache.bcel.LocalVariableTypeTableTestCase
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.001 sec <<< FAILURE! - in org.apache.bcel.LocalVariableTypeTableTestCase
testWithGenericArguement(org.apache.bcel.LocalVariableTypeTableTestCase) Time elapsed: 0.001 sec <<< ERROR!
java.lang.ClassFormatError: LVTT entry for 'a2' in class file org/apache/bcel/data/SimpleClassHasMethodIncludeGenericArgument does not match any LVT entry
at org.apache.bcel.LocalVariableTypeTableTestCase.testWithGenericArguement(LocalVariableTypeTableTestCase.java:40)

Running org.apache.bcel.InstructionFinderTestCase
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.014 sec - in org.apache.bcel.InstructionFinderTestCase
Running org.apache.bcel.AnnotationDefaultAttributeTestCase
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in org.apache.bcel.AnnotationDefaultAttributeTestCase
Running org.apache.bcel.classfile.ConstantPoolTestCase
aload_0
invokespecial java/lang/Object/()V
return
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec - in org.apache.bcel.classfile.ConstantPoolTestCase
Running org.apache.bcel.classfile.UtilityTestCase
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 sec - in org.apache.bcel.classfile.UtilityTestCase
Running org.apache.bcel.generic.FieldAnnotationsTestCase
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.008 sec - in org.apache.bcel.generic.FieldAnnotationsTestCase
Running org.apache.bcel.generic.TypeTestCase
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec - in org.apache.bcel.generic.TypeTestCase
Running org.apache.bcel.generic.AnnotationGenTestCase
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in org.apache.bcel.generic.AnnotationGenTestCase
Running org.apache.bcel.generic.JDKGenericDumpTestCase
/home/sam/java/jdk1.7.0_80/jre/lib/javaws.jar
/home/sam/java/jdk1.7.0_80/jre/lib/resources.jar
/home/sam/java/jdk1.7.0_80/jre/lib/management-agent.jar
/home/sam/java/jdk1.7.0_80/jre/lib/rt.jar
/home/sam/java/jdk1.7.0_80/jre/lib/alt-rt.jar
/home/sam/java/jdk1.7.0_80/jre/lib/jce.jar
/home/sam/java/jdk1.7.0_80/jre/lib/deploy.jar
/home/sam/java/jdk1.7.0_80/jre/lib/plugin.jar
/home/sam/java/jdk1.7.0_80/jre/lib/jfxrt.jar
/home/sam/java/jdk1.7.0_80/jre/lib/jsse.jar
/home/sam/java/jdk1.7.0_80/jre/lib/charsets.jar
/home/sam/java/jdk1.7.0_80/jre/lib/jfr.jar
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.888 sec - in org.apache.bcel.generic.JDKGenericDumpTestCase
Running org.apache.bcel.generic.InstructionHandleTestCase
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 sec - in org.apache.bcel.generic.InstructionHandleTestCase
Running org.apache.bcel.generic.BranchHandleTestCase
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 sec - in org.apache.bcel.generic.BranchHandleTestCase
Running org.apache.bcel.generic.GeneratingAnnotatedClassesTestCase
Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.025 sec - in org.apache.bcel.generic.GeneratingAnnotatedClassesTestCase
Running org.apache.bcel.generic.MethodGenTestCase
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec - in org.apache.bcel.generic.MethodGenTestCase
Running org.apache.bcel.AnonymousClassTestCase
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec - in org.apache.bcel.AnonymousClassTestCase
Running org.apache.bcel.CounterVisitorTestCase
Tests run: 37, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec - in org.apache.bcel.CounterVisitorTestCase
Running org.apache.bcel.EnumAccessFlagTestCase
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in org.apache.bcel.EnumAccessFlagTestCase
Running org.apache.bcel.PerformanceTest
parsing /home/sam/java/jdk1.7.0_80/jre/lib/javaws.jar
parsing /home/sam/java/jdk1.7.0_80/jre/lib/resources.jar
parsing /home/sam/java/jdk1.7.0_80/jre/lib/management-agent.jar
parsing /home/sam/java/jdk1.7.0_80/jre/lib/rt.jar
parsing /home/sam/java/jdk1.7.0_80/jre/lib/alt-rt.jar
parsing /home/sam/java/jdk1.7.0_80/jre/lib/jce.jar
parsing /home/sam/java/jdk1.7.0_80/jre/lib/deploy.jar
parsing /home/sam/java/jdk1.7.0_80/jre/lib/plugin.jar
parsing /home/sam/java/jdk1.7.0_80/jre/lib/jfxrt.jar
parsing /home/sam/java/jdk1.7.0_80/jre/lib/jsse.jar
parsing /home/sam/java/jdk1.7.0_80/jre/lib/charsets.jar
parsing /home/sam/java/jdk1.7.0_80/jre/lib/jfr.jar
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.92 sec - in org.apache.bcel.PerformanceTest
Running org.apache.bcel.util.Class2HTMLTestCase
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.008 sec - in org.apache.bcel.util.Class2HTMLTestCase
Running org.apache.bcel.util.BCELifierTestCase
Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0 sec - in org.apache.bcel.util.BCELifierTestCase
Running org.apache.bcel.verifier.VerifierArrayAccessTestCase
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.052 sec - in org.apache.bcel.verifier.VerifierArrayAccessTestCase
Running org.apache.bcel.verifier.VerifierReturnTestCase
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.018 sec - in org.apache.bcel.verifier.VerifierReturnTestCase
Running org.apache.bcel.verifier.VerifierInvokeTestCase
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.043 sec - in org.apache.bcel.verifier.VerifierInvokeTestCase
Running org.apache.bcel.verifier.VerifierTestCase
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in org.apache.bcel.verifier.VerifierTestCase

Results :

Tests in error:
LocalVariableTypeTableTestCase.testWithGenericArguement:40 » ClassFormat LVTT ...

Tests run: 104, Failures: 0, Errors: 1, Skipped: 1

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.684s
[INFO] Finished at: Thu Aug 04 20:12:13 KST 2016
[INFO] Final Memory: 30M/348M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project bcel: There are test failures.
[ERROR]
[ERROR] Please refer to /home/sam/workspace/commons-bcel/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Process finished with exit code 1

@KyongSik-Yoon

This comment has been minimized.

Show comment
Hide comment
@KyongSik-Yoon

KyongSik-Yoon Aug 4, 2016

@britter I received confirm email about sent my ICLA.
I've signed as name "Yoon Sam"

KyongSik-Yoon commented Aug 4, 2016

@britter I received confirm email about sent my ICLA.
I've signed as name "Yoon Sam"

@KyongSik-Yoon

This comment has been minimized.

Show comment
Hide comment
@KyongSik-Yoon

KyongSik-Yoon Aug 4, 2016

@britter If you cannot reproduce on your environment I`ll attach a result of javap included an information about LocalVariableTable.

I have already checked a result of javap missing LocalVariableTable for Generic parameter of the method.

KyongSik-Yoon commented Aug 4, 2016

@britter If you cannot reproduce on your environment I`ll attach a result of javap included an information about LocalVariableTable.

I have already checked a result of javap missing LocalVariableTable for Generic parameter of the method.

@KyongSik-Yoon

This comment has been minimized.

Show comment
Hide comment
@KyongSik-Yoon

KyongSik-Yoon Aug 6, 2016

@britter I found other workaround. I have an experience that fixed a bug BCEL 5.2 and also the modifications remained on my project. So recently I was comparing with my BCEL and latest BCEL 6.0 on Github. In this phase I found that BCEL don't need to take care of LocalVariableTypeTable. So we must not to add code attributes. When I prepared to modify it I'll register PR again. When you see my comment let you close this PR. Thanks.

KyongSik-Yoon commented Aug 6, 2016

@britter I found other workaround. I have an experience that fixed a bug BCEL 5.2 and also the modifications remained on my project. So recently I was comparing with my BCEL and latest BCEL 6.0 on Github. In this phase I found that BCEL don't need to take care of LocalVariableTypeTable. So we must not to add code attributes. When I prepared to modify it I'll register PR again. When you see my comment let you close this PR. Thanks.

@britter

This comment has been minimized.

Show comment
Hide comment
@britter

britter Aug 16, 2016

Member

@KyongSik-Yoon sorry I was on vacation. I'm having a look at this soon.

Member

britter commented Aug 16, 2016

@KyongSik-Yoon sorry I was on vacation. I'm having a look at this soon.

@britter

This comment has been minimized.

Show comment
Hide comment
@britter

britter Aug 18, 2016

Member

@KyongSik-Yoon Can you update this PR to incorporate what we've discussed so far? See my inline comments.

Member

britter commented Aug 18, 2016

@KyongSik-Yoon Can you update this PR to incorporate what we've discussed so far? See my inline comments.

@KyongSik-Yoon

This comment has been minimized.

Show comment
Hide comment
@KyongSik-Yoon

KyongSik-Yoon Aug 19, 2016

@britter LocalVariableTypeTableTest have been not executing due to the rule of test case class name.
BCEL maven build script run test case class have a rule of the name end with TestCase.
At first try change class name LocalVariableTypeTableTest to LocalVariableTypeTableTestCase then this case will be executed.
I can PR again this name modification but you do better it because Github rule of Apache Common project seems to not allowed merge source of PR by general developer.

KyongSik-Yoon commented Aug 19, 2016

@britter LocalVariableTypeTableTest have been not executing due to the rule of test case class name.
BCEL maven build script run test case class have a rule of the name end with TestCase.
At first try change class name LocalVariableTypeTableTest to LocalVariableTypeTableTestCase then this case will be executed.
I can PR again this name modification but you do better it because Github rule of Apache Common project seems to not allowed merge source of PR by general developer.

@britter

This comment has been minimized.

Show comment
Hide comment
@britter

britter Aug 19, 2016

Member

@KyongSik-Yoon you can modify your PR by pushing more commits to your fork. Summing up the changes that need to be implemented before we can merge this:

  • revert reorganization of imports in org.apache.bcel.generic.MethodGen
  • remove author attribution in org.apache.bcel.generic.MethodGen line 241 - I will add you to the contributors section of pom.xml
  • remove @author tags in org.apache.bcel.LocalVariableTypeTableTest and data.SimpleClassHasMethodIncludeGenericArgument
  • rename LocalVariableTypeTableTest to LocalVariableTypeTableTestCase

Thank you!

Member

britter commented Aug 19, 2016

@KyongSik-Yoon you can modify your PR by pushing more commits to your fork. Summing up the changes that need to be implemented before we can merge this:

  • revert reorganization of imports in org.apache.bcel.generic.MethodGen
  • remove author attribution in org.apache.bcel.generic.MethodGen line 241 - I will add you to the contributors section of pom.xml
  • remove @author tags in org.apache.bcel.LocalVariableTypeTableTest and data.SimpleClassHasMethodIncludeGenericArgument
  • rename LocalVariableTypeTableTest to LocalVariableTypeTableTestCase

Thank you!

@KyongSik-Yoon

This comment has been minimized.

Show comment
Hide comment
@KyongSik-Yoon

KyongSik-Yoon Aug 19, 2016

@britter OK, I'll follow your comment. I'm on working time in my company. So I'll do that after get off.

KyongSik-Yoon commented Aug 19, 2016

@britter OK, I'll follow your comment. I'm on working time in my company. So I'll do that after get off.

KyongSik-Yoon added some commits Aug 22, 2016

Merge remote-tracking branch 'origin/BCEL-276' into BCEL-276
Conflicts:
	src/main/java/org/apache/bcel/generic/MethodGen.java
	src/test/java/org/apache/bcel/data/SimpleClassHasMethodIncludeGenericArgument.java
@KyongSik-Yoon

This comment has been minimized.

Show comment
Hide comment
@KyongSik-Yoon

KyongSik-Yoon Aug 22, 2016

@britter I was update source code and push again. Please check it.

KyongSik-Yoon commented Aug 22, 2016

@britter I was update source code and push again. Please check it.

@britter

This comment has been minimized.

Show comment
Hide comment
@britter

britter Aug 22, 2016

Member

@KyongSik-Yoon now the branch has merge conflicts. Have you tried rebasing your branch against trunk after fixing the comments?

Member

britter commented Aug 22, 2016

@KyongSik-Yoon now the branch has merge conflicts. Have you tried rebasing your branch against trunk after fixing the comments?

KyongSik-Yoon added some commits Aug 23, 2016

Merge remote-tracking branch 'remotes/upstream/trunk' into BCEL-276
Conflicts:
	src/test/java/org/apache/bcel/classfile/ConstantPoolTestCase.java
	src/test/java/org/apache/bcel/data/SimpleClassWithDefaultConstructor.java
@KyongSik-Yoon

This comment has been minimized.

Show comment
Hide comment
@KyongSik-Yoon

KyongSik-Yoon Aug 23, 2016

@britter Sorry. I was rebase my branch with trunk. I checked there is no conflict when try merge automatically.

KyongSik-Yoon commented Aug 23, 2016

@britter Sorry. I was rebase my branch with trunk. I checked there is no conflict when try merge automatically.

@britter

This comment has been minimized.

Show comment
Hide comment
@britter

britter Aug 23, 2016

Member

@KyongSik-Yoon added two additional comments.

Member

britter commented Aug 23, 2016

@KyongSik-Yoon added two additional comments.

@KyongSik-Yoon

This comment has been minimized.

Show comment
Hide comment
@KyongSik-Yoon

KyongSik-Yoon Aug 23, 2016

@britter I saw your comments. Reorganized importing code was rebased. I was fixed it and added a comment for your question.

KyongSik-Yoon commented Aug 23, 2016

@britter I saw your comments. Reorganized importing code was rebased. I was fixed it and added a comment for your question.

@KyongSik-Yoon

This comment has been minimized.

Show comment
Hide comment
@KyongSik-Yoon

KyongSik-Yoon commented Aug 29, 2016

@britter ping

@britter

This comment has been minimized.

Show comment
Hide comment
@britter

britter Aug 29, 2016

Member

@KyongSik-Yoon there are some discussions on the mailing list about whether this fix is complete [1]. The discussion indicates that merging this my break other users of BCEL. I think we need to find out how to implement this change without breaking third party code.

[1] http://markmail.org/message/xivobmyi4zxyrv6m

Member

britter commented Aug 29, 2016

@KyongSik-Yoon there are some discussions on the mailing list about whether this fix is complete [1]. The discussion indicates that merging this my break other users of BCEL. I think we need to find out how to implement this change without breaking third party code.

[1] http://markmail.org/message/xivobmyi4zxyrv6m

@KyongSik-Yoon

This comment has been minimized.

Show comment
Hide comment
@KyongSik-Yoon

KyongSik-Yoon Aug 29, 2016

@britter I have also fixed the code same with BCEL-79 and faced with cause error on my customer environment. (It's corrupted an environment using multiple javaagent). BCEL-79 also tried add else clause for LocalVariableTypeTable.
So I trace our product code and I found history that LocalVariableTypeTable must do not anything in MethodGen constructor for existing method. After adopt my modification(add else clause for LocalVariableTypeTable without method body) to our customer error is not occurred anymore and their service status fine now.
I have experience with BCEL during at least 5 years and this modified code is running on over 1000 enterprise customers.
So I think this fix have a confidence but surely this fix also cannot control LocalVariableTypeTable.

KyongSik-Yoon commented Aug 29, 2016

@britter I have also fixed the code same with BCEL-79 and faced with cause error on my customer environment. (It's corrupted an environment using multiple javaagent). BCEL-79 also tried add else clause for LocalVariableTypeTable.
So I trace our product code and I found history that LocalVariableTypeTable must do not anything in MethodGen constructor for existing method. After adopt my modification(add else clause for LocalVariableTypeTable without method body) to our customer error is not occurred anymore and their service status fine now.
I have experience with BCEL during at least 5 years and this modified code is running on over 1000 enterprise customers.
So I think this fix have a confidence but surely this fix also cannot control LocalVariableTypeTable.

@KyongSik-Yoon

This comment has been minimized.

Show comment
Hide comment
@KyongSik-Yoon

KyongSik-Yoon Aug 29, 2016

@britter Finally, I success regenerate LocalVariableTypeTable info. It's shown correctly on a result of javap -v command and passed my test case. Here is 2 AM so late. When I get up in the morning I'll merge code to my branch.

KyongSik-Yoon commented Aug 29, 2016

@britter Finally, I success regenerate LocalVariableTypeTable info. It's shown correctly on a result of javap -v command and passed my test case. Here is 2 AM so late. When I get up in the morning I'll merge code to my branch.

@KyongSik-Yoon

This comment has been minimized.

Show comment
Hide comment
@KyongSik-Yoon

KyongSik-Yoon Aug 30, 2016

@britter I was commit the implementation to LocalVariableTypeTable section. Please check it.
I found the reason why cause "does not match any LVT entry".
The start pc of each LocalVariable's except uses a type variable or parameterized type calculated again when called getMethod but LocalVariable's in LocalVariableTypeTable was not.
So JVM cannot match LocalVariable in LVTT with LVT.
After fix LocalVariableTypeTable section can be shown on a result of javap command.

I attached a part of the result.

public static void a(java.lang.String, java.util.List<java.lang.String>);
descriptor: (Ljava/lang/String;Ljava/util/List;)V
flags: ACC_PUBLIC, ACC_STATIC
Signature: #20 // (Ljava/lang/String;Ljava/util/List<Ljava/lang/String;>;)V
Code:
stack=2, locals=2, args_size=2
0: getstatic #43 // Field java/lang/System.out:Ljava/io/PrintStream;
3: aload_0
4: invokevirtual #49 // Method java/io/PrintStream.println:(Ljava/lang/String;)V
7: return
LocalVariableTable:
Start Length Slot Name Signature
7 1 0 a1 Ljava/lang/String;
7 1 1 a2 Ljava/util/List;
LocalVariableTypeTable: // before code missing this section. but now ok.
Start Length Slot Name Signature
7 1 1 a2 Ljava/util/List<Ljava/lang/String;>;
LineNumberTable:
line 24: 7

KyongSik-Yoon commented Aug 30, 2016

@britter I was commit the implementation to LocalVariableTypeTable section. Please check it.
I found the reason why cause "does not match any LVT entry".
The start pc of each LocalVariable's except uses a type variable or parameterized type calculated again when called getMethod but LocalVariable's in LocalVariableTypeTable was not.
So JVM cannot match LocalVariable in LVTT with LVT.
After fix LocalVariableTypeTable section can be shown on a result of javap command.

I attached a part of the result.

public static void a(java.lang.String, java.util.List<java.lang.String>);
descriptor: (Ljava/lang/String;Ljava/util/List;)V
flags: ACC_PUBLIC, ACC_STATIC
Signature: #20 // (Ljava/lang/String;Ljava/util/List<Ljava/lang/String;>;)V
Code:
stack=2, locals=2, args_size=2
0: getstatic #43 // Field java/lang/System.out:Ljava/io/PrintStream;
3: aload_0
4: invokevirtual #49 // Method java/io/PrintStream.println:(Ljava/lang/String;)V
7: return
LocalVariableTable:
Start Length Slot Name Signature
7 1 0 a1 Ljava/lang/String;
7 1 1 a2 Ljava/util/List;
LocalVariableTypeTable: // before code missing this section. but now ok.
Start Length Slot Name Signature
7 1 1 a2 Ljava/util/List<Ljava/lang/String;>;
LineNumberTable:
line 24: 7

@KyongSik-Yoon

This comment has been minimized.

Show comment
Hide comment
@KyongSik-Yoon

KyongSik-Yoon Aug 30, 2016

@britter I updated something. Now recalculate timing moved to when call getMethod(). I've thinking about the result of javap. Each of LocalVariable in LVT start pc retained at that time before bytecode instrumentation. As a result, All of start pc cannot indicate the first instruction of method body. So I moved regenerate LocalVariableTable timing from constructor to getMethod() execution. And also update a length of Variable's in LVTT.

You can see following a result of javap

Before use BCEL

public static void a(java.lang.String, java.util.List<java.lang.String>);
    descriptor: (Ljava/lang/String;Ljava/util/List;)V
    flags: ACC_PUBLIC, ACC_STATIC
    Code:
      stack=0, locals=2, args_size=2
         0: return
      LineNumberTable:
        line 24: 0
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0       1     0    a1   Ljava/lang/String;
            0       1     1    a2   Ljava/util/List;
      LocalVariableTypeTable:
        Start  Length  Slot  Name   Signature
            0       1     1    a2   Ljava/util/List<Ljava/lang/String;>;
    Signature: #20

After use BCEL

public static void a(java.lang.String, java.util.List<java.lang.String>);
    descriptor: (Ljava/lang/String;Ljava/util/List;)V
    flags: ACC_PUBLIC, ACC_STATIC
    Signature: #20                          // (Ljava/lang/String;Ljava/util/List<Ljava/lang/String;>;)V
    Code:
      stack=2, locals=2, args_size=2
         0: getstatic     #43                 // Field java/lang/System.out:Ljava/io/PrintStream;
         3: aload_0
         4: invokevirtual #49                 // Method java/io/PrintStream.println:(Ljava/lang/String;)V
         7: return
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0       8     0    a1   Ljava/lang/String;
            0       8     1    a2   Ljava/util/List;
      LocalVariableTypeTable:
        Start  Length  Slot  Name   Signature
            0       8     1    a2   Ljava/util/List<Ljava/lang/String;>;
      LineNumberTable:
        line 24: 7

KyongSik-Yoon commented Aug 30, 2016

@britter I updated something. Now recalculate timing moved to when call getMethod(). I've thinking about the result of javap. Each of LocalVariable in LVT start pc retained at that time before bytecode instrumentation. As a result, All of start pc cannot indicate the first instruction of method body. So I moved regenerate LocalVariableTable timing from constructor to getMethod() execution. And also update a length of Variable's in LVTT.

You can see following a result of javap

Before use BCEL

public static void a(java.lang.String, java.util.List<java.lang.String>);
    descriptor: (Ljava/lang/String;Ljava/util/List;)V
    flags: ACC_PUBLIC, ACC_STATIC
    Code:
      stack=0, locals=2, args_size=2
         0: return
      LineNumberTable:
        line 24: 0
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0       1     0    a1   Ljava/lang/String;
            0       1     1    a2   Ljava/util/List;
      LocalVariableTypeTable:
        Start  Length  Slot  Name   Signature
            0       1     1    a2   Ljava/util/List<Ljava/lang/String;>;
    Signature: #20

After use BCEL

public static void a(java.lang.String, java.util.List<java.lang.String>);
    descriptor: (Ljava/lang/String;Ljava/util/List;)V
    flags: ACC_PUBLIC, ACC_STATIC
    Signature: #20                          // (Ljava/lang/String;Ljava/util/List<Ljava/lang/String;>;)V
    Code:
      stack=2, locals=2, args_size=2
         0: getstatic     #43                 // Field java/lang/System.out:Ljava/io/PrintStream;
         3: aload_0
         4: invokevirtual #49                 // Method java/io/PrintStream.println:(Ljava/lang/String;)V
         7: return
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0       8     0    a1   Ljava/lang/String;
            0       8     1    a2   Ljava/util/List;
      LocalVariableTypeTable:
        Start  Length  Slot  Name   Signature
            0       8     1    a2   Ljava/util/List<Ljava/lang/String;>;
      LineNumberTable:
        line 24: 7
@britter

This comment has been minimized.

Show comment
Hide comment
@britter

britter Sep 3, 2016

Member

@KyongSik-Yoon It's great how much effort you're putting into this. Really appreciated! Unfortunately a hand full of tests fail after applying your changes. Have you run mvn clean verify after applying your changes? Here is the log of the test run.

Member

britter commented Sep 3, 2016

@KyongSik-Yoon It's great how much effort you're putting into this. Really appreciated! Unfortunately a hand full of tests fail after applying your changes. Have you run mvn clean verify after applying your changes? Here is the log of the test run.

@KyongSik-Yoon

This comment has been minimized.

Show comment
Hide comment
@KyongSik-Yoon

KyongSik-Yoon Sep 5, 2016

@britter It's a happiness as a programmer. I'll find the reason and fix it. Maybe no need much time.

KyongSik-Yoon commented Sep 5, 2016

@britter It's a happiness as a programmer. I'll find the reason and fix it. Maybe no need much time.

@KyongSik-Yoon

This comment has been minimized.

Show comment
Hide comment
@KyongSik-Yoon

KyongSik-Yoon Sep 6, 2016

@britter I fixed build fail. I checked a result of mvn clean verify is success.

KyongSik-Yoon commented Sep 6, 2016

@britter I fixed build fail. I checked a result of mvn clean verify is success.

@britter

This comment has been minimized.

Show comment
Hide comment
@britter

britter Sep 6, 2016

Member

@KyongSik-Yoon Your patch has been applied. The change should sync to GitHub soon. Thank you for fighting through this. Good work!

Member

britter commented Sep 6, 2016

@KyongSik-Yoon Your patch has been applied. The change should sync to GitHub soon. Thank you for fighting through this. Good work!

@asfgit asfgit closed this in c96a3e5 Sep 6, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment