Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsrinivasan2010-01-13 23:57:31 +0000
committerrsrinivasan2010-01-13 23:57:31 +0000
commit97a1875b6925b3a1d5c2acf7a8b077bb6990a35a (patch)
tree77f6a052cdaad5ea35c77de9f6da82acb10d7349
parent8bebf0b8f4ea05318dc89afc2698c1099e01e33b (diff)
downloadwebtools.jsf-97a1875b6925b3a1d5c2acf7a8b077bb6990a35a.tar.gz
webtools.jsf-97a1875b6925b3a1d5c2acf7a8b077bb6990a35a.tar.xz
webtools.jsf-97a1875b6925b3a1d5c2acf7a8b077bb6990a35a.zip
Applying fixes in the 3.0.5 Patch stream - Bug 290412, Bug 288291, Bug 288831
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/util/TypeUtil.java18
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/DivArithmeticBinaryOperator.java7
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualityRelationalBinaryOperator.java4
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LogicalBinaryOperator.java5
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LtGtRelationalBinaryOperator.java7
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MemberAccessorOperator.java3
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MinusUnaryOperator.java3
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/ModArithmeticBinaryOperator.java5
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NoDivArithmeticBinaryOperator.java7
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NotUnaryOperator.java3
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/TernaryChoiceOperator.java5
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/AttributeValidatingStrategy.java27
12 files changed, 82 insertions, 12 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/util/TypeUtil.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/util/TypeUtil.java
index dd2d6e66a..8a465d8d3 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/util/TypeUtil.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/util/TypeUtil.java
@@ -15,16 +15,15 @@ package org.eclipse.jst.jsf.common.util;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
import org.eclipse.jdt.core.ITypeParameter;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jst.jsf.common.JSFCommonPlugin;
import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
+import org.eclipse.jst.jsf.common.internal.types.TypeInfoCache;
/**
* Utility for handling IType's and type signatures
@@ -359,11 +358,13 @@ public final class TypeUtil
throws JavaModelException
{
IType resolvedType = null;
+
+ final TypeInfoCache typeInfoCache = TypeInfoCache.getInstance();
+ IType[] superTypes = typeInfoCache.getCachedSupertypes(childType);
+ if (superTypes == null) {
+ superTypes = typeInfoCache.cacheSupertypesFor(childType);
+ }
- // not resolved? try the supertypes
- final ITypeHierarchy typeHierarchy =
- childType.newSupertypeHierarchy(new NullProgressMonitor());
- IType[] superTypes = typeHierarchy.getAllSupertypes(childType);
String[][] resolved;
LOOP_UNTIL_FIRST_MATCH:
@@ -394,9 +395,8 @@ public final class TypeUtil
*/
public static IType resolveType(final IJavaProject javaProject, final String fullyResolvedTypeSignature)
{
- final String fullyQualifiedName =
- getFullyQualifiedName(fullyResolvedTypeSignature);
-
+ String fullyQualifiedName = getFullyQualifiedName(fullyResolvedTypeSignature);
+ fullyQualifiedName = Signature.getTypeErasure(fullyQualifiedName);
try {
return javaProject.findType(fullyQualifiedName);
} catch (JavaModelException e) {
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/DivArithmeticBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/DivArithmeticBinaryOperator.java
index c41f8ebdd..67242ec60 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/DivArithmeticBinaryOperator.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/DivArithmeticBinaryOperator.java
@@ -70,7 +70,12 @@ import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
}
public Diagnostic validate(ValueType firstArg, ValueType secondArg) {
- // JSP.2.3.5.2, step one: if both null then always 0
+ if (TypeConstants.TYPE_JAVAOBJECT.equals(firstArg.getSignature()) ||
+ TypeConstants.TYPE_JAVAOBJECT.equals(secondArg.getSignature())) {
+ return Diagnostic.OK_INSTANCE;
+ }
+
+ // JSP.2.3.5.2, step one: if both null then always 0
if (TypeCoercer.typeIsNull(firstArg.getSignature())
&& TypeCoercer.typeIsNull(secondArg.getSignature()))
{
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualityRelationalBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualityRelationalBinaryOperator.java
index dcefc2ee3..963f9ad00 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualityRelationalBinaryOperator.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualityRelationalBinaryOperator.java
@@ -193,6 +193,10 @@ import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
}
public Diagnostic validate(ValueType firstArg, ValueType secondArg) {
+ if (TypeConstants.TYPE_JAVAOBJECT.equals(firstArg.getSignature()) ||
+ TypeConstants.TYPE_JAVAOBJECT.equals(secondArg.getSignature())) {
+ return Diagnostic.OK_INSTANCE;
+ }
// JSP.2.3.5.7 step 2 if either operand is null, then not equal
if (TypeCoercer.typeIsNull(firstArg.getSignature())
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LogicalBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LogicalBinaryOperator.java
index e76d5ef07..deb4e9b7f 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LogicalBinaryOperator.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LogicalBinaryOperator.java
@@ -93,6 +93,11 @@ import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
public Diagnostic validate(ValueType firstArg, ValueType secondArg)
{
+ if (TypeConstants.TYPE_JAVAOBJECT.equals(firstArg.getSignature()) ||
+ TypeConstants.TYPE_JAVAOBJECT.equals(secondArg.getSignature())) {
+ return Diagnostic.OK_INSTANCE;
+ }
+
final boolean canCoerceFirstArg =
TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(firstArg.getSignature()));
final boolean canCoerceSecondArg =
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LtGtRelationalBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LtGtRelationalBinaryOperator.java
index e4695ac88..8d8445c5b 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LtGtRelationalBinaryOperator.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LtGtRelationalBinaryOperator.java
@@ -125,7 +125,12 @@ import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
public Diagnostic validate(ValueType firstArg, ValueType secondArg)
{
- // JSP.2.3.5.6 step 2 if either operand is null, then always false
+ if (TypeConstants.TYPE_JAVAOBJECT.equals(firstArg.getSignature()) ||
+ TypeConstants.TYPE_JAVAOBJECT.equals(secondArg.getSignature())) {
+ return Diagnostic.OK_INSTANCE;
+ }
+
+ // JSP.2.3.5.6 step 2 if either operand is null, then always false
if (TypeCoercer.typeIsNull(firstArg.getSignature())
|| TypeCoercer.typeIsNull(secondArg.getSignature()))
{
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MemberAccessorOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MemberAccessorOperator.java
index 003fe4990..b346d9fcd 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MemberAccessorOperator.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MemberAccessorOperator.java
@@ -75,6 +75,9 @@ public abstract class MemberAccessorOperator
*/
public Diagnostic validate(final ValueType firstArg, final ValueType secondArg)
{
+ if (TypeConstants.TYPE_JAVAOBJECT.equals(firstArg.getSignature())) {
+ return Diagnostic.OK_INSTANCE;
+ }
if (!(firstArg instanceof IObjectSymbolBasedValueType))
{
throw new AssertionError(
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MinusUnaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MinusUnaryOperator.java
index 1c4f9ed32..91705d9db 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MinusUnaryOperator.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MinusUnaryOperator.java
@@ -45,6 +45,9 @@ import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
public Diagnostic validate(ValueType type)
{
+ if (TypeConstants.TYPE_JAVAOBJECT.equals(type.getSignature())) {
+ return Diagnostic.OK_INSTANCE;
+ }
// must coerce to numeric type
try
{
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/ModArithmeticBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/ModArithmeticBinaryOperator.java
index 4d6b01f08..0b6ac7d01 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/ModArithmeticBinaryOperator.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/ModArithmeticBinaryOperator.java
@@ -83,6 +83,11 @@ import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
}
public Diagnostic validate(ValueType firstArg, ValueType secondArg) {
+ if (TypeConstants.TYPE_JAVAOBJECT.equals(firstArg.getSignature()) ||
+ TypeConstants.TYPE_JAVAOBJECT.equals(secondArg.getSignature())) {
+ return Diagnostic.OK_INSTANCE;
+ }
+
// JSP.2.3.5.3, step 1 if both null, then return zero
if (TypeCoercer.typeIsNull(firstArg.getSignature())
&& TypeCoercer.typeIsNull(secondArg.getSignature()))
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NoDivArithmeticBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NoDivArithmeticBinaryOperator.java
index 8f11373d1..3b057545d 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NoDivArithmeticBinaryOperator.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NoDivArithmeticBinaryOperator.java
@@ -99,7 +99,12 @@ import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
public Diagnostic validate(ValueType firstArg, ValueType secondArg)
{
- // JSP.2.3.5.1, step 1, if either arg is null, return (Long) 0
+ if (TypeConstants.TYPE_JAVAOBJECT.equals(firstArg.getSignature()) ||
+ TypeConstants.TYPE_JAVAOBJECT.equals(secondArg.getSignature())) {
+ return Diagnostic.OK_INSTANCE;
+ }
+
+ // JSP.2.3.5.1, step 1, if either arg is null, return (Long) 0
if (TypeCoercer.typeIsNull(firstArg.getSignature())
&& TypeCoercer.typeIsNull(secondArg.getSignature()))
{
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NotUnaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NotUnaryOperator.java
index 3a3b070b0..f8f09b22e 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NotUnaryOperator.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NotUnaryOperator.java
@@ -38,6 +38,9 @@ import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
public Diagnostic validate(ValueType type)
{
+ if (TypeConstants.TYPE_JAVAOBJECT.equals(type.getSignature())) {
+ return Diagnostic.OK_INSTANCE;
+ }
boolean canCoerce =
TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(type.getSignature()));
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/TernaryChoiceOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/TernaryChoiceOperator.java
index 2cb457e83..a6a36838a 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/TernaryChoiceOperator.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/TernaryChoiceOperator.java
@@ -17,6 +17,7 @@ import org.eclipse.jst.jsf.common.internal.types.IAssignable;
import org.eclipse.jst.jsf.common.internal.types.LiteralType;
import org.eclipse.jst.jsf.common.internal.types.TypeCoercer;
import org.eclipse.jst.jsf.common.internal.types.TypeCoercionException;
+import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
import org.eclipse.jst.jsf.common.internal.types.TypeTransformer;
import org.eclipse.jst.jsf.common.internal.types.ValueType;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
@@ -99,6 +100,10 @@ public class TernaryChoiceOperator
*/
public Diagnostic validate(ValueType choiceArg)
{
+ if (TypeConstants.TYPE_JAVAOBJECT.equals(choiceArg.getSignature())) {
+ return Diagnostic.OK_INSTANCE;
+ }
+
final boolean isChoiceBoolean =
TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(choiceArg.getSignature()));
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 c9f2781a3..7be62a0a6 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
@@ -35,6 +35,8 @@ import org.eclipse.jst.jsf.common.dom.DOMAdapter;
import org.eclipse.jst.jsf.common.internal.types.CompositeType;
import org.eclipse.jst.jsf.common.internal.types.TypeComparator;
import org.eclipse.jst.jsf.common.internal.types.TypeComparatorDiagnosticFactory;
+import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
+import org.eclipse.jst.jsf.common.internal.types.TypeTransformer;
import org.eclipse.jst.jsf.common.runtime.internal.model.ViewObject;
import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentFactory;
import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo;
@@ -362,6 +364,31 @@ AbstractXMLViewValidationStrategy
final CompositeType exprType = elValidator.getExpressionType();
if (exprType != null)
{
+ // Ignore the expression whose last two segments are of types Object.
+ final CompositeType boxedType = TypeTransformer
+ .transformBoxPrimitives(exprType);
+ final String[] testSignatures = boxedType.getSignatures();
+ if (testSignatures.length > 0 && TypeConstants.TYPE_JAVAOBJECT.equals(testSignatures[0]))
+ {
+ if (elText.indexOf('.') != -1)
+ {
+ String elText2 = elText.substring(0, elText.lastIndexOf('.'));
+ final ELExpressionValidator elValidator2 = new ELExpressionValidator(
+ elContext, elText2, _validationContext
+ .getSymbolResolverFactory(), _validationContext
+ .getReporter());
+ elValidator2.validateXMLNode();
+
+ final CompositeType exprType2 = elValidator.getExpressionType();
+ final CompositeType boxedType2 = TypeTransformer.transformBoxPrimitives(exprType2);
+ final String[] testSignatures2 = boxedType2.getSignatures();
+ if (testSignatures2.length > 0 && TypeConstants.TYPE_JAVAOBJECT.equals(testSignatures2[0]))
+ {
+ return;
+ }
+ }
+ }
+
for (final Iterator it = elVals.iterator(); it.hasNext();)
{
final IValidELValues elval = (IValidELValues) it.next();

Back to the top