| Summary: | Ignore optional compile problems Java build path option not honored | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Dani Megert <daniel_megert> |
| Component: | Tycho | Assignee: | Project Inbox <tycho-inbox> |
| Status: | RESOLVED WORKSFORME | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | jan.sievers, jarthana, Lars.Vogel |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| See Also: | https://bugs.eclipse.org/bugs/show_bug.cgi?id=507055 | ||
| Whiteboard: | |||
|
Description
Dani Megert
we are only passing the compiler .prefs file to the JDT compiler using -properties <path/to/prefs> do you have a small example project or can you elaborate a bit more on which setting should take which effect? Not small but here is an example: Clone the rt.equinox.framework repository and import the org.eclipse.osgi bundle. Select "felix/src" folder, right-click on it and select Properties. See that "Java Compiler" has the "Ignore optional compile problems" setting. With "Ignore optional compile problems" set, JDT (seems to) ignore the project settings for the corresponding source folder. For example, an unnecessary import which is set to error, is ignored. (In reply to Lars Vogel from comment #3) > With "Ignore optional compile problems" set, JDT (seems to) ignore the > project settings for the corresponding source folder. For example, an > unnecessary import which is set to error, is ignored. It does not ignore the settings, but simply does not report optional compile problems. (In reply to Jan Sievers from comment #1) > do you have a small example project or can you elaborate a bit more on which > setting should take which effect? 1. paste this into the Package Explorer: import java.util.Map; public class Test { } 2. set the project setting for unused imports to 'Error' 3. open the Java build path settings and expand the 'src' folder 4. toggle 'Ignore optional compile problems' ==> the error is gone. However, the Tycho build using project settings will issue the error. (In reply to Dani Megert from comment #5) > (In reply to Jan Sievers from comment #1) > > do you have a small example project or can you elaborate a bit more on which > > setting should take which effect? > > 1. paste this into the Package Explorer: > import java.util.Map; > public class Test { > } > 2. set the project setting for unused imports to 'Error' > 3. open the Java build path settings and expand the 'src' folder > 4. toggle 'Ignore optional compile problems' > ==> the error is gone. > > However, the Tycho build using project settings will issue the error. so this is a setting saved in .classpath Right now we do not parse .classpath as this is a derived resource as far as Tycho is concerned with build.properties as the master. if there is a corresponding switch for the JDT core CLI we could forward it. If this is handled on the (JDT) UI level only I guess it will be hard to replicate the behaviour in Tycho (In reply to Jan Sievers from comment #6) > if there is a corresponding switch for the JDT core CLI we could forward it. > If this is handled on the (JDT) UI level only I guess it will be hard to > replicate the behaviour in Tycho I don't think we have an option in ECJ. Jay, please confirm. (In reply to Dani Megert from comment #7) > I don't think we have an option in ECJ. Jay, please confirm. I wasn't aware of this before, but we do have support for this! Here's the relevant documentation: -nowarn -warn:none disable all warnings -nowarn:[<directories separated by {0}>] specify directories from which optional problems should be ignored An example would be: -nowarn:["C:\regression\src1";"C:\regression\src2"] (In reply to Jay Arthanareeswaran from comment #8) > (In reply to Dani Megert from comment #7) > > I don't think we have an option in ECJ. Jay, please confirm. > > I wasn't aware of this before, but we do have support for this! Here's the > relevant documentation: > > -nowarn -warn:none disable all warnings > -nowarn:[<directories separated by {0}>] > specify directories from which optional problems should > be ignored > > An example would be: > > -nowarn:["C:\regression\src1";"C:\regression\src2"] Can one use variables? Otherwise this will not really work. (In reply to Dani Megert from comment #9) > Can one use variables? Otherwise this will not really work. I am not sure what you meant by variables. In any case, the answer is: no, whoever is invoking the compiler need to pass all the source folders where this particular rule should be applied. (In reply to Dani Megert from comment #9) > (In reply to Jay Arthanareeswaran from comment #8) > > (In reply to Dani Megert from comment #7) > > > I don't think we have an option in ECJ. Jay, please confirm. > > > > I wasn't aware of this before, but we do have support for this! Here's the > > relevant documentation: > > > > -nowarn -warn:none disable all warnings > > -nowarn:[<directories separated by {0}>] > > specify directories from which optional problems should > > be ignored > > > > An example would be: > > > > -nowarn:["C:\regression\src1";"C:\regression\src2"] > > Can one use variables? Otherwise this will not really work. I just verified that you can manually configure this, see sample project https://github.com/jsievers/tycho-demo-1/tree/bug506781/itp01 commit https://github.com/jsievers/tycho-demo-1/commit/20d9feb0a27054f1567aabd81eea243bac69470f Essentially you can use <compilerArgs> <arg>-nowarn:[${project.basedir}/src]</arg> </compilerArgs> (or whatever source dir you want to ignore) (In reply to Jan Sievers from comment #11) > Essentially you can use > > <compilerArgs> > <arg>-nowarn:[${project.basedir}/src]</arg> > </compilerArgs> > > (or whatever source dir you want to ignore) Thanks, that's what I was hoping. just one more hint, in case you have multiple dirs it looks like you have to use OS-specific path separator
${path.separator}
|