I’d say it’s the bug in the Sun compiler reported here and here, because if you change your line to the one below it works with both, which seems to be exactly what is described in the bug reports.
return GenericsTest2.<T>readObject(new ObjectInputStream(new FileInputStream(file)));
More Related Contents:
- Possible heap pollution via varargs parameter
- Reference is ambiguous with generics
- Compilers behave differently with a null parameter of a generic method
- When does object pointed by 'Example.class' come into existence?
- NoClassDefFoundError – Eclipse and Android
- How to create a jar with external libraries included in Eclipse?
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
- Build Eclipse Java Project from Command Line
- SQLite in Android How to update a specific row
- How to change JDK version for an Eclipse project
- “Unable to acquire application service” error while launching Eclipse
- Why does javac complain about generics unrelated to the class’ type arguments? [duplicate]
- Preserving parameter/argument names in compiled Java classes
- Eclipse – “Incompatible JVM. Version 1.8.0_261 of the JVM is not suitable for this product. Version: 11 or greater is required”
- Cast Object to Generic Type for returning
- How to generate Javadoc HTML files in Eclipse?
- Attach the Source in Eclipse of a jar
- Invoking Java main method with parameters from Eclipse
- How to resize an image when resizing the window in JavaFX
- Cannot find Main Class in File Compiled With Ant
- Any simple way to explain why I cannot do List animals = new ArrayList()? [duplicate]
- how to export (JUnit) test suite as executable jar
- Java Regex pattern that matches in any online tester but doesn’t in Eclipse
- Find methods calls in Eclipse project
- How to create a executable jar file for Testng and the runnnig point should be the Xml file
- How to get current class name including package name in Java?
- Using assertArrayEquals in unit tests
- Changing Tomcat context path of web project in Eclipse
- Where are the generated JSP class files located?
- Why is Ant giving me a Unsupported major.minor version error