tiebin-zhang / powermock

Automatically exported from code.google.com/p/powermock
Apache License 2.0
0 stars 0 forks source link

powermock-module-junit4-rule 1.5 requires JDK 1.6 #417

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a simple test using the powermock runner and annotate a test with 
@PrepareTest and a class with static fields. Use powermock-junit4-rule version 
1.5 in the pom. 
2. Run mvn test on jdk 5.
3. Tests will fail due to an initialization error. Surefire reports will log a 
"java.lang.UnsupportedClassVersionError: Bad version number in .class file", 
when attempting to load class in 
"org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.<i
nit>(JUnit4TestSuiteChunkerImpl.java:47)"

What is the expected output? What do you see instead?
Tests should pass since powermock has been compiled with source and target of 
JDK 1.5 (see powermock pom).

What version of the product are you using? On what operating system?
powermock 1.5, maven 2.2.1, jdk 1.5.

Please provide any additional information below.
Version 1.4.12 worked fine with JDK 1.5, seems like this release could be 
perfectly compatible with JDK 1.5 if javassist-3.17.1-GA hadn't been released 
as a JDK 6 jar. 3.16.1-GA was a JDK 1.5 jar.
As a workaround, I added the previous version to the pom:
<dependencyManagement>
  <dependencies>
   <dependency>
     <groupId>org.javassist</groupId>
     <artifactId>javassist</artifactId>
     <version>3.16.1-GA</version>
   </dependency>
  </dependencies>
</dependencyManagement>
This seemed to solve the issue for me, but I haven't validated everything else 
works. 
To me, a JDK bump seems like a major version bump (since it's non-passive). So, 
would it be possible to make javassist 3.17.1-GA mandatory only if we're 
wanting to run against JDK 1.7, and make it mandatory on a new major branch 
(i.e. 2.x)?
PS: I'm assuming the versioning scheme used by the powermock team is following 
the apache guidelines, please disregard the last paragraph if not.

Original issue reported on code.google.com by cleber.z...@gmail.com on 19 Dec 2012 at 3:54

GoogleCodeExporter commented 9 years ago
Hi, 

When I released PowerMock 1.5 I was not aware of this issue since what I've 
read in discussion groups Javassist should work with JDK 1.4. But apparently I 
was wrong. Your work-around is probably the way to go for now.

/Johan 

Original comment by johan.ha...@gmail.com on 22 Jan 2013 at 7:30