diff options
author | gkessler | 2010-05-05 21:15:50 +0000 |
---|---|---|
committer | gkessler | 2010-05-05 21:15:50 +0000 |
commit | d2410a3781a8696bc276a0883aac8dfc5f66d249 (patch) | |
tree | cd14d65a0e2fe38022fce6e4affdc6cfc75b0e4e /jsf | |
parent | 868c437236a6dbdc5f4ea128da24b42959289dee (diff) | |
download | webtools.jsf-d2410a3781a8696bc276a0883aac8dfc5f66d249.tar.gz webtools.jsf-d2410a3781a8696bc276a0883aac8dfc5f66d249.tar.xz webtools.jsf-d2410a3781a8696bc276a0883aac8dfc5f66d249.zip |
[311626] Avoid reporting false-positive warnings when validating value expression for type compatibility
Diffstat (limited to 'jsf')
2 files changed, 26 insertions, 10 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeComparatorPreferences.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeComparatorPreferences.java index 7428cb19c..49f63bc6a 100644 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeComparatorPreferences.java +++ b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeComparatorPreferences.java @@ -32,7 +32,7 @@ public class TypeComparatorPreferences case TypeComparatorDiagnosticFactory.METHOD_EXPRESSION_EXPECTED_ID: return Diagnostic.ERROR; case TypeComparatorDiagnosticFactory.INCOMPATIBLE_TYPES_ID: - return Diagnostic.WARNING; + return Diagnostic.INFO; case TypeComparatorDiagnosticFactory.VALUE_EXPRESSION_EXPECTED_ID: return Diagnostic.ERROR; case TypeComparatorDiagnosticFactory.INCOMPATIBLE_METHOD_TYPES_ID: diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/AttributeValidatingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/AttributeValidatingStrategy.java index 7f887a21e..e921d48b8 100644 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/AttributeValidatingStrategy.java +++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/AttributeValidatingStrategy.java @@ -28,7 +28,6 @@ import org.eclipse.core.runtime.SafeRunner; import org.eclipse.emf.common.util.BasicDiagnostic; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.jdt.core.Signature; -import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jst.jsf.common.dom.AttrDOMAdapter; import org.eclipse.jst.jsf.common.dom.AttributeIdentifier; import org.eclipse.jst.jsf.common.dom.DOMAdapter; @@ -82,6 +81,7 @@ public class AttributeValidatingStrategy extends AbstractXMLViewValidationStrategy { private static final String DISABLE_ALTERATIVE_TYPES_KEY = "jsfCoreDisableConverterValidation"; //$NON-NLS-1$ + private static final String ENABLE_ALTERATIVE_TYPES_KEY = "jsfCoreEnableConverterValidation"; //$NON-NLS-1$ static final boolean DEBUG; static { @@ -427,17 +427,30 @@ AbstractXMLViewValidationStrategy private boolean disableAlternativeTypes() { - String res = System.getProperty(DISABLE_ALTERATIVE_TYPES_KEY); - if (res == null) { - //check env var also - res = System.getenv(DISABLE_ALTERATIVE_TYPES_KEY); - } - if (res != null) + if (hasProperty(DISABLE_ALTERATIVE_TYPES_KEY)) { return true; } - final IPreferenceStore prefStore = JSFCorePlugin.getDefault().getPreferenceStore(); - return prefStore.getBoolean("org.eclipse.jst.jsf.core."+DISABLE_ALTERATIVE_TYPES_KEY); //$NON-NLS-1$ + + if (hasProperty(ENABLE_ALTERATIVE_TYPES_KEY)) + { + return false; + } + +// As of Helios, alternative type is disabled by default + return true; + +// final IPreferenceStore prefStore = JSFCorePlugin.getDefault().getPreferenceStore(); +// return prefStore.getBoolean("org.eclipse.jst.jsf.core."+DISABLE_ALTERATIVE_TYPES_KEY); //$NON-NLS-1$ + } + + private boolean hasProperty(final String key) { + String res = System.getProperty(key); + if (res == null) { + //check env var also + res = System.getenv(key); + } + return res != null; } /** * @return true if alternative type comparison (i.e. post-conversion) passes @@ -448,6 +461,9 @@ AbstractXMLViewValidationStrategy final Region2AttrAdapter attrAdapter) { final long curTime = System.nanoTime(); + + //As of Helios, alternative type is disabled by default + //and enabled by the ENABLE_ALTERNATIVE_TYPES_KEY system/env property if (disableAlternativeTypes()) { return expectedType; |