[311626] Avoid reporting false-positive warnings when validating value expression for type compatibility
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 7428cb1..49f63bc 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 @@
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 7f887a2..e921d48 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.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 @@
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 @@
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 @@
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;