| Summary: | [3.1final] org.eclipse.pde.internal.build.FeatureWriter has compile errors | ||
|---|---|---|---|
| Product: | [Eclipse Project] PDE | Reporter: | Bob Foster <bob> |
| Component: | Build | Assignee: | Andrew Niefer <aniefer> |
| Status: | RESOLVED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | adamrabung, bkonrath, darin.eclipse, dficu4j, dirk_baeumer, eclipse, francois, nichoj, Olivier_Thomann, pombredanne, sonia_dimitrov |
| Version: | 3.1 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
|
Description
Bob Foster
I have loaded from the repository and its ok. I also imported it as source and it was ok. - is your target platform set to be a 3.1 install? - are its required plug-ins available either in your target platform or in your workspace? - are its required plug-ins the right versions? Please annotate with the list of errors as well. I downloaded the SDK and installed it, imported the entire SDK as source projects. There aren't any missing dependencies. The errors I'm seeing are reported against the imported source. The errors are: Severity Description Resource In Folder Location Creation Time 2 The return type is incompatible with Writer.append(char), PrintWriter.append(char) FeatureWriter.java org.eclipse.pde.build/src-pdebuild/org/eclipse/pde/internal/build line 24 July 5, 2005 7:49:48 AM 2 The return type is incompatible with Writer.append(CharSequence, int, int), PrintWriter.append(CharSequence, int, int) FeatureWriter.java org.eclipse.pde.build/src-pdebuild/org/eclipse/pde/internal/build line 24 July 5, 2005 7:49:48 AM 2 The return type is incompatible with Writer.append(CharSequence), PrintWriter.append(CharSequence) FeatureWriter.java org.eclipse.pde.build/src-pdebuild/org/eclipse/pde/internal/build line 24 July 5, 2005 7:49:48 AM This is on WinXP SP2. If you do the same thing I did on the same platform and don't see an error, well, I don't know what to say. ;-} Interesting. What java libraries are you compiling against? jre1.5.0_02 unaltered I have also encoutered the same problem. I'm using jre1.5.0_03-b07 and my OS is WinXP + SP2. I just can't understand the error messages, for I don't find any function named append in FeatureWriter.java. I have the same problem when using a 1.5 VM. I will investigate. Here is a summary: FeatureWriter extends XMLWriter. XMLWriter extends PrintWriter. PrintWriter extends Writer. Writer#append -> returns Writer PrintWriter#append -> returns PrintWriter In 1.5, PrintWriter#append was added. As far as I can tell, this all should be ok? Olivier, do you know why this is giving us problems? Changing the compiler compliance level to 1.5 fixes these errors. (but presents 1 new one) Window -> Preferences -> Java -> Compiler -> Compiler Compliance Level If I start a fresh Eclipse 3.1 install with a 1.5 VM, shouldn't 1.5 be set as the default compliance level? Who is setting this value? Dirk, do you know? The default compiler compliance level is set by JDT/Core. Since most of the Java development is still 1.4 based we didn't switch the default compiler compliance level to 1.5. It is still 1.4 out of the box, even if the VM Eclipse is running on is 1.5. Compiling 1.4 code against a 1.5 JDK can cause compile errors due to covariant return types which got added for 1.5. If we want to switch the default compiler compliance in this case this is best done by launching since they detect the default VM. However, we should only do it if it is a fresh workspace. Can we somehow detect this ? This could be done when we detect the default JRE for the workspace (first startup). When you change the compiler compliance level to 5.0 in preferences, the default generated class file compatibility and source compatibility default to 5.0. (Whereas for 1.4, the two compatibility settings are 1.2 and 1.3, respectively.) My first thought was that some people would probably object to automatically changing the class file compatibility, because it limits the target environments their code can run in. But then I realized the whole relationship between source level and class compatibility level are murky, at least in my mind, for 5.0. Can you use 5.0 features in source and still generate 1.2-compatible class files? (This is still offered as a menu selection.) Are there some 5.0 features, e.g., the nanotimer, that don't work without 5.0-compatible class files? Which ones? When compliance is 5.0 (or 1.5), then target and source are set to 5.0. I tried to change the target version to 1.2 having compliance set to 5.0 and I could not do it. It is offered in the menu, but selecting it leads to an error message as an invalid setting. javac sets the target to 1.5 when the source is 1.5. You can however set the source to 1.4 even if the compliance is set to 5.0. This would be the same settings than compiling using -source 1.4 with javac 1.5. The compiler doesn't check that the methods used are 1.5 specific or not. If you target a 1.4 VM, you should use 1.4 libraries to compile. In general, it is recommended to use the same libraries to compile than the target platform. (In reply to comment #7) > Olivier, do you know why this is giving us problems? I think you have an issue with the covariance return type. This is allowed if the compliance is 1.5 and source is 1.5. Ok, so the problem is caused by compiling at the 1.4 compliance level with 1.5 libraries, not all of which are 1.4-compatible? If you solve the problem by automatically setting the level to 1.5 for new workspaces so the imported source of eclipse plugins will compile, does that also mean you will implicitly set the target to 1.5 for any products in the workspace? Such products won't run in, e.g., MacOS X 1.3, which is still about half the Mac installed base; cutting the Mac market in half doesn't sound appealing. Alternatively, if there were a way to run Eclipse and applications in the 1.5 JVM but use 1.4 libraries to compile with... You can run Eclips using 1.5 but do all the development against 1.4. Simply remove the auto detected 1.5 VM from the list of installed JREs and add a normal 1.4 JDK. The suggestion is that we switch the default compiler compliance only to 5.0 if you start up Eclipse on a freh workspace and run Eclipse using a 1.5 VM. In this case there is obviously a 5.0 compliant VM on the system. I opened bug 103026 for requesting switching the default. We need to add the proper JRE markup in the build.properties. I have a workspace that has some 1.4 projects, but mostly 1.5 projects. Project specific compiler compliance levels is an amazingly good feature. I'm not sure I understand how the JRE System Library under Java Build Path => Libraries is chosen, but it seems like the most straightforward approach is to synch the JRE System Library w/ the projects compiler compliance level, rather than trying to choose a sensible default. If a user is targeting 1.4, they must compile against 1.4's rt.jar. However, for whatever reason, my Eclipse defaults to using 1.5 rt.jar as the JRE System Library for all projects - if I have a 1.4 project I need to correct it manually. New => Java Project Select "Use default compiler compliance (1.4) Next Select libraries tab Note the JRE System Library is 1.5, not 1.4 Any code in this project that deals w/ "1.5ish" Sun apis will have weird compile errors, as described. Could the JRE System Library be automatically synched with the compiler compliance level? *** Bug 125091 has been marked as a duplicate of this bug. *** (In reply to comment #18) > *** Bug 125091 has been marked as a duplicate of this bug. *** Bug 125091 concerns building the eclipse environment itself, as opposed to projects within eclipse. Attempting to do that with JSE 5.0 does not work unless I set the source level to 1.5 in the top-level build.xml of the eclipse source. This predated the usage of EE. Now everything is in order. |