Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-wtp-dev] Dubious org.eclipse.jdt.core.compiler.problem.forbiddenReference setting in AbstractJavaProjectConfigurator

Hi,

by default (i.e. with stock workspace settings), forbidden references raise errors. But in AbstractJavaProjectConfigurator[1], the default forbiddenReference value is always set to "warning", unless user preferences have already been set[2]) Any idea why? 

Only reason I see would be to make eclipse as lenient as maven, but I believe this is precisely a situation where we want the IDE to be stricter.
Ex: would better detect the use of JVM specific classes and force users to conscientiously change the forbidden references settings in Project Properties > Java > Compiler > Error/Warnings > Deprecated and Restricted API. These custom settings being preserved on Maven Project Update.

Another reason to keep the default workspace value is I want to be able to add custom access rules on EJB projects dependencies, in order to simulate "ejb-client" type dependencies in m2e-wtp. In that use case, I expect any project depending on non-ejbclient vetted class would see an error (red marker).

Soooo, I propose we remove that piece of code in AbstractJavaProjectConfigurator :

    // 360962 keep forbidden_reference severity set by the user
    IJavaProject jp = JavaCore.create(request.getProject());
    if(jp != null && jp.getOption(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, true) == null) {
     options.put(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, "warning"); //$NON-NLS-1$
    }

Any objections?

Fred Bricon

[1] http://git.eclipse.org/c/m2e/m2e-core.git/diff/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java?id=3d354e58f72f7385ed8a3f817cedec61106d32c1
[2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=360962
--
"Have you tried turning it off and on again" - The IT Crowd

Back to the top