Hi, I have a problem with running a program at java 7, and in fact on java 6 on non-commercial platform (ubuntu). But it is really the fact that java 7 is telling me to upgrade that concerns me, so I wonder if you could help tell me if a) this is in fact a bug and b) if there as a jvm switch /setting that can be used to allow this backwards-compatibility.
The problem is that a particular setter is not found at java 7, for the code as attached, whereas it is found at java 6 (on windows and rhel java, at least). This a maven project, which you don't actually have to run, but the comments in the pom file will show you the output if you do run it. Here is the output under java 6 & 7: C:\Documents and Settings\...>"%JAVA_HOME%\bin\java" -cp . JavaBeansBug java version: 1.6.0_24 created object, introspecting with java.beans.BeanInfo NO SETTER:class C:\Documents and Settings\...>java -cp . JavaBeansBug java version: 1.7.0 created object, introspecting with java.beans.BeanInfo NO SETTER:class NO SETTER:providerManager Thanks for any advice. I can't change the code because it belongs to public libraries which no longer seem maintained. I have distilled the issue to the above sample code, I think. Peter Rushforth Technology Advisor / Conseiller technique GeoConnections / GéoConnexions 650-615 Booth St. / rue Booth Ottawa ON K1A 0E9 E-mail / Courriel: [email protected] Phone / Télephone: (613) 943-0784 Fax / telecopier: (613) 947-2410
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.peter</groupId> <artifactId>JavaBeansBugMaven</artifactId> <packaging>jar</packaging> <version>1.0-SNAPSHOT</version> <name>JavaBeansBugMaven</name> <url>http://maven.apache.org</url> <!-- The output from this program documents a difference between the way Java 6 vs Java 7 introspect objects. This difference is not limited to simply java 6 vs 7 but also Java 6 as implemented on Red Hat, Windows, Ubuntu, ... As a result, our api which depends on public libraries which use this pattern, DOES NOT RUN ON JAVA 7, AND JAVA 6 PLATFORMS WHICH BEHAVE LIKE JAVA 7. C:\Documents and Settings\...>"%JAVA_HOME%\bin\java" -cp . JavaBeansBug java version: 1.6.0_24 created object, introspecting with java.beans.BeanInfo NO SETTER:class C:\Documents and Settings\...>java -cp . JavaBeansBug java version: 1.7.0 created object, introspecting with java.beans.BeanInfo NO SETTER:class NO SETTER:providerManager --> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> <build> <finalName>JavaBeansBug</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>copy-dependencies</id> <phase>prepare-package</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/lib</outputDirectory> <overWriteReleases>false</overWriteReleases> <overWriteSnapshots>false</overWriteSnapshots> <overWriteIfNewer>true</overWriteIfNewer> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> <classpathPrefix>lib/</classpathPrefix> <mainClass>JavaBeansBug</mainClass> </manifest> </archive> </configuration> </plugin> </plugins> </build> </project>
AbstractServiceContext.java
Description: AbstractServiceContext.java
ServiceContext.java
Description: ServiceContext.java
Provider.java
Description: Provider.java
JavaBeansBug.java
Description: JavaBeansBug.java
ItemManager.java
Description: ItemManager.java
DefaultServiceContext.java
Description: DefaultServiceContext.java
