[pkg-eucalyptus-commits] r218 - in gwt/trunk/debian: . patches
Chris Halls
halls at alioth.debian.org
Wed Jul 4 12:08:19 UTC 2012
Author: halls
Date: 2012-07-04 12:08:19 +0000 (Wed, 04 Jul 2012)
New Revision: 218
Added:
gwt/trunk/debian/ant.properties
gwt/trunk/debian/patches/build-protobuf-class
gwt/trunk/debian/patches/build-tests
gwt/trunk/debian/patches/build-with-jdt37
gwt/trunk/debian/patches/fix-guava-pkg-path
gwt/trunk/debian/patches/fix-protobuf-pkg-path
gwt/trunk/debian/patches/fix-streamhtmlparser-pkg-path
gwt/trunk/debian/patches/use-json-simple
Modified:
gwt/trunk/debian/build.xml
gwt/trunk/debian/control
gwt/trunk/debian/patches/build.patch
gwt/trunk/debian/patches/exclude-tomcat.patch
gwt/trunk/debian/patches/series
gwt/trunk/debian/rules
Log:
Add changes by Alexandre Rossi
Added: gwt/trunk/debian/ant.properties
===================================================================
--- gwt/trunk/debian/ant.properties (rev 0)
+++ gwt/trunk/debian/ant.properties 2012-07-04 12:08:19 UTC (rev 218)
@@ -0,0 +1,35 @@
+gwt.vendor.builddeps = debian
+
+ant-contrib.jar = /usr/share/java/ant-contrib.jar
+
+# Common
+commons-collections3.jar = /usr/share/java/commons-collections3.jar
+guava.jar = /usr/share/java/guava.jar
+servlet-api.jar = /usr/share/java/servlet-api-2.5.jar
+htmlunit.jar = /usr/share/java/htmlunit.jar
+htmlunit-core-js.jar = /usr/share/java/htmlunit-core-js.jar
+jetty.jar = /usr/share/java/jetty.jar
+jetty-util.jar = /usr/share/java/jetty-util.jar
+
+# Dev
+ant.jar = /usr/share/java/ant.jar
+ecj.jar = /usr/share/java/ecj.jar
+# FIXME: Use wildcards here for jdt
+#jdt.jar = /usr/lib/eclipse/plugins/org.eclipse.jdt.core_3.5.*.jar:/usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.jdt.core_3.7.*.jar
+#jdt.jar = /usr/lib/eclipse/plugins/org.eclipse.jdt.core_3.5.2.v_981_R35x.jar
+jdt.jar = /usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.jdt.core_3.7.0.dist.jar
+protobuf.jar = /usr/share/java/protobuf-java.jar
+commons-logging.jar = /usr/share/java/commons-logging.jar
+
+# Dev-tests
+junit4.jar = /usr/share/java/junit4.jar
+jfreechart.jar = /usr/share/java/jfreechart.jar
+sac.jar = /usr/share/java/sac.jar
+
+# User
+icu4j.jar = /usr/share/java/icu4j.jar
+jsilver.jar = /usr/share/java/jsilver.jar
+flute.jar = /usr/share/java/flute.jar
+json-simple.jar = /usr/share/java/json_simple.jar
+geronimo-validation.jar = /usr/share/java/geronimo-validation.jar
+hibernate-validator.jar = /usr/share/java/hibernate-validator.jar
Modified: gwt/trunk/debian/build.xml
===================================================================
--- gwt/trunk/debian/build.xml 2012-06-13 04:16:44 UTC (rev 217)
+++ gwt/trunk/debian/build.xml 2012-07-04 12:08:19 UTC (rev 218)
@@ -4,12 +4,14 @@
<target name="build">
<ant dir="dev/"/>
- <ant dir="dev/linux/"/>
<ant dir="user/"/>
<ant dir="servlet/"/>
</target>
<target name="clean">
+ <ant dir="dev/" target="clean" />
+ <ant dir="user/" target="clean" />
+ <ant dir="servlet/" target="clean" />
<delete dir="build"/>
<delete dir="${target.dir}"/>
<!-- Also remove this leftover of the GWT build system -->
Modified: gwt/trunk/debian/control
===================================================================
--- gwt/trunk/debian/control 2012-06-13 04:16:44 UTC (rev 217)
+++ gwt/trunk/debian/control 2012-07-04 12:08:19 UTC (rev 218)
@@ -12,7 +12,12 @@
libecj-java,
libswt-gtk-3-java, libswt-gtk-3-java-gcj,
junit
-Build-Depends: ant, debhelper (>= 5), cdbs (>= 0.4.5.3)
+ eclipse-jdt,
+ libguava-java, libhtmlunit-java, libhtmlunit-core-js-java,
+ libjetty-java, libprotobuf-java, protobuf-compiler, libcommons-logging-java,
+ libgeronimo-validation-1.0-spec-java, libicu4j-java, libjson-simple-java,
+ libflute-java, libjsilver-java
+Build-Depends: ant, ant-contrib, debhelper (>= 5), cdbs (>= 0.4.5.3)
Standards-Version: 3.9.2
Vcs-Svn: svn://svn.debian.org/pkg-eucalyptus/gwt/trunk
Vcs-Browser: http://svn.debian.org/websvn/pkg-eucalyptus/gwt
Added: gwt/trunk/debian/patches/build-protobuf-class
===================================================================
--- gwt/trunk/debian/patches/build-protobuf-class (rev 0)
+++ gwt/trunk/debian/patches/build-protobuf-class 2012-07-04 12:08:19 UTC (rev 218)
@@ -0,0 +1,47 @@
+Index: gwt-debian/dev/build.xml
+===================================================================
+--- gwt-debian.orig/dev/build.xml 2011-12-21 11:56:17.000000000 +0100
++++ gwt-debian/dev/build.xml 2011-12-21 12:05:51.340745186 +0100
+@@ -31,6 +31,11 @@
+ <delete failonerror="false">
+ <fileset dir="${gwt.build.lib}" includes="gwt-dev.jar"/>
+ </delete>
++
++ <!-- Restore protobuf generated file as source dist -->
++ <move file="./core/src/com/google/gwt/dev/shell/remoteui/RemoteMessageProto.java.orig"
++ tofile="./core/src/com/google/gwt/dev/shell/remoteui/RemoteMessageProto.java"
++ preservelastmodified="true" failonerror="false" />
+ </target>
+
+ <target name="compile.tests" depends="build, compile.emma.if.enabled" description="Compiles the test code for this project">
+@@ -181,7 +186,7 @@
+ </gwt.javac>
+ </target>
+
+- <target name="compile" depends="compiler.standalone" description="Compiles this project">
++ <target name="compile" depends="compiler.standalone, generate.remotemessageproto.java" description="Compiles this project">
+ <gwt.javac srcdir="" excludes="${filter.pattern}">
+ <src path="core/src" />
+ <classpath>
+@@ -194,16 +199,17 @@
+ </target>
+
+ <target name="generate.remotemessageproto.java">
++ <!-- Backup file from source dist -->
++ <copy file="./core/src/com/google/gwt/dev/shell/remoteui/RemoteMessageProto.java"
++ tofile="./core/src/com/google/gwt/dev/shell/remoteui/RemoteMessageProto.java.orig"
++ preservelastmodified="true" />
++
+ <!-- Generate the java code -->
+ <exec executable="protoc" failonerror="true">
+ <arg value="--java_out=core/src"/>
+ <arg value="./core/src/com/google/gwt/dev/shell/remoteui/remotemessage.proto"/>
+ </exec>
+
+- <!-- Rebase the java code to match the rebased protobuf library -->
+- <replace file="./core/src/com/google/gwt/dev/shell/remoteui/RemoteMessageProto.java">
+- <replacefilter token="com.google.protobuf" value="com.google.gwt.dev.protobuf"/>
+- </replace>
+ </target>
+
+ <target name="checkstyle" description="Static analysis of source">
Added: gwt/trunk/debian/patches/build-tests
===================================================================
--- gwt/trunk/debian/patches/build-tests (rev 0)
+++ gwt/trunk/debian/patches/build-tests 2012-07-04 12:08:19 UTC (rev 218)
@@ -0,0 +1,15 @@
+Index: gwt-debian/dev/core/test/com/google/gwt/dev/javac/BinaryTypeReferenceRestrictionsCheckerTest.java
+===================================================================
+--- gwt-debian.orig/dev/core/test/com/google/gwt/dev/javac/BinaryTypeReferenceRestrictionsCheckerTest.java 2011-12-21 11:43:29.277245427 +0100
++++ gwt-debian/dev/core/test/com/google/gwt/dev/javac/BinaryTypeReferenceRestrictionsCheckerTest.java 2011-12-21 11:44:26.308746537 +0100
+@@ -92,6 +92,10 @@
+ return null;
+ }
+
++ public char[] getEnclosingMethod() {
++ return null;
++ }
++
+ public char[][][] getMissingTypeNames() {
+ return null;
+ }
Added: gwt/trunk/debian/patches/build-with-jdt37
===================================================================
--- gwt/trunk/debian/patches/build-with-jdt37 (rev 0)
+++ gwt/trunk/debian/patches/build-with-jdt37 2012-07-04 12:08:19 UTC (rev 218)
@@ -0,0 +1,6118 @@
+Index: gwt-debian/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java
+===================================================================
+--- gwt-debian.orig/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java 2011-12-21 11:43:29.249247218 +0100
++++ gwt-debian/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java 2011-12-21 11:44:39.305246214 +0100
+@@ -410,7 +410,7 @@
+ // Turn off all warnings, saves some memory / speed.
+ options.reportUnusedDeclaredThrownExceptionIncludeDocCommentReference = false;
+ options.reportUnusedDeclaredThrownExceptionExemptExceptionAndThrowable = false;
+- options.warningThreshold = 0;
++ options.suppressWarnings = true;
+ options.inlineJsrBytecode = true;
+ return options;
+ }
+@@ -440,7 +440,7 @@
+
+ if (type != null) {
+ if (type instanceof UnresolvedReferenceBinding) {
+- type = BinaryTypeBinding.resolveType(type, lookupEnvironment, true);
++ type = (ReferenceBinding) BinaryTypeBinding.resolveType(type, lookupEnvironment, true);
+ }
+ // found it
+ return type;
+Index: gwt-debian/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java
+===================================================================
+--- gwt-debian.orig/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java 2011-12-21 11:43:29.229246303 +0100
++++ gwt-debian/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java 2011-12-21 11:44:39.325245355 +0100
+@@ -1,12 +1,12 @@
+ /*
+ * Copyright 2010 Google Inc.
+- *
++ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+- *
++ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+- *
++ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+@@ -223,7 +223,7 @@
+ * Visit the JDT AST and produce our own AST. By the end of this pass, the
+ * produced AST should contain every piece of information we'll ever need
+ * about the code. The JDT nodes should never again be referenced after this.
+- *
++ *
+ * NOTE ON JDT FORCED OPTIMIZATIONS - If JDT statically determines that a
+ * section of code in unreachable, it won't fully resolve that section of
+ * code. This invalid-state code causes us major problems. As a result, we
+@@ -543,7 +543,7 @@
+ SourceInfo info = makeSourceInfo(x);
+ JType type = typeMap.get(x.resolvedType);
+ JExpression expression = pop(x.expression);
+- if (x.type instanceof NameReference) {
++ if ((Expression)x.type instanceof NameReference) {
+ pop(x.type);
+ }
+ push(new JCastOperation(info, type, expression));
+@@ -1917,7 +1917,7 @@
+ * inherits that implements an interface method but that has a different
+ * erased signature from the interface method.
+ * </p>
+- *
++ *
+ * <p>
+ * The need for these bridges was pointed out in issue 3064. The goal is
+ * that virtual method calls through an interface type are translated to
+@@ -1932,7 +1932,7 @@
+ * case, a bridge method should be added that overrides the interface method
+ * and then calls the implementation method.
+ * </p>
+- *
++ *
+ * <p>
+ * This method should only be called once all regular, non-bridge methods
+ * have been installed on the GWT types.
+@@ -2521,7 +2521,7 @@
+ * primitive with a modified prototype. This requires funky handling of
+ * constructor calls. We find a method named _String() whose signature
+ * matches the requested constructor
+- *
++ *
+ * TODO(scottb): consider moving this to a later pass.
+ */
+ MethodBinding staticBinding =
+@@ -2649,7 +2649,7 @@
+ /*
+ * Make an inner class to hold a lazy-init name-value map. We use a
+ * class to take advantage of its clinit.
+- *
++ *
+ * class Map { $MAP = Enum.createValueOfMap($VALUES); }
+ */
+ SourceInfo info = type.getSourceInfo();
+@@ -2751,7 +2751,7 @@
+
+ /**
+ * Manually tracked version count.
+- *
++ *
+ * TODO(zundel): something much more awesome?
+ */
+ private static final long AST_VERSION = 1;
+Index: gwt-debian/dev/core/src/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
+===================================================================
+--- gwt-debian.orig/dev/core/src/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 2011-12-21 11:43:29.189246230 +0100
++++ gwt-debian/dev/core/src/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 2011-12-21 11:44:39.313245223 +0100
+@@ -1,5 +1,5 @@
+ /*******************************************************************************
+- * Copyright (c) 2000, 2008 IBM Corporation and others.
++ * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+@@ -51,19 +51,14 @@
+ if (binaryValue == null) return null;
+ if (binaryValue instanceof Constant)
+ return binaryValue;
+- if (binaryValue instanceof ClassSignature) {
+- TypeBinding typeFromSignature = env.getTypeFromSignature(((ClassSignature) binaryValue).getTypeName(), 0, -1, false, null, missingTypeNames);
+- if (typeFromSignature.isBaseType()) {
+- return typeFromSignature;
+- }
+- return resolveType((ReferenceBinding) typeFromSignature, env, false);
+- }
++ if (binaryValue instanceof ClassSignature)
++ return env.getTypeFromSignature(((ClassSignature) binaryValue).getTypeName(), 0, -1, false, null, missingTypeNames);
+ if (binaryValue instanceof IBinaryAnnotation)
+ return createAnnotation((IBinaryAnnotation) binaryValue, env, missingTypeNames);
+ if (binaryValue instanceof EnumConstantSignature) {
+ EnumConstantSignature ref = (EnumConstantSignature) binaryValue;
+ ReferenceBinding enumType = (ReferenceBinding) env.getTypeFromSignature(ref.getTypeName(), 0, -1, false, null, missingTypeNames);
+- enumType = resolveType(enumType, env, false);
++ enumType = (ReferenceBinding) resolveType(enumType, env, false /* no raw conversion */);
+ return enumType.getField(ref.getEnumConstantName(), false);
+ }
+ if (binaryValue instanceof Object[]) {
+@@ -79,6 +74,7 @@
+ // should never reach here.
+ throw new IllegalStateException();
+ }
++
+ static AnnotationBinding createAnnotation(IBinaryAnnotation annotationInfo, LookupEnvironment env, char[][][] missingTypeNames) {
+ IBinaryElementValuePair[] binaryPairs = annotationInfo.getElementValuePairs();
+ int length = binaryPairs == null ? 0 : binaryPairs.length;
+@@ -90,6 +86,7 @@
+ ReferenceBinding annotationType = env.getTypeFromConstantPoolName(typeName, 1, typeName.length - 1, false, missingTypeNames);
+ return new UnresolvedAnnotationBinding(annotationType, pairs, env);
+ }
++
+ public static AnnotationBinding[] createAnnotations(IBinaryAnnotation[] annotationInfos, LookupEnvironment env, char[][][] missingTypeNames) {
+ int length = annotationInfos == null ? 0 : annotationInfos.length;
+ AnnotationBinding[] result = length == 0 ? Binding.NO_ANNOTATIONS : new AnnotationBinding[length];
+@@ -97,46 +94,36 @@
+ result[i] = createAnnotation(annotationInfos[i], env, missingTypeNames);
+ return result;
+ }
+-public static ReferenceBinding resolveType(ReferenceBinding type, LookupEnvironment environment, boolean convertGenericToRawType) {
+- if (type instanceof UnresolvedReferenceBinding)
+- return ((UnresolvedReferenceBinding) type).resolve(environment, convertGenericToRawType);
+- switch (type.kind()) {
+- case Binding.PARAMETERIZED_TYPE :
+- return ((ParameterizedTypeBinding) type).resolve();
+- case Binding.WILDCARD_TYPE :
+- case Binding.INTERSECTION_TYPE :
+- return ((WildcardBinding) type).resolve();
+- }
+- if (convertGenericToRawType) // raw reference to generic ?
+- return (ReferenceBinding) environment.convertUnresolvedBinaryToRawType(type);
+- return type;
+-}
+-public static TypeBinding resolveType(TypeBinding type, LookupEnvironment environment, ParameterizedTypeBinding parameterizedType, int rank) {
++
++public static TypeBinding resolveType(TypeBinding type, LookupEnvironment environment, boolean convertGenericToRawType) {
+ switch (type.kind()) {
+-
+ case Binding.PARAMETERIZED_TYPE :
+- return ((ParameterizedTypeBinding) type).resolve();
+-
++ ((ParameterizedTypeBinding) type).resolve();
++ break;
++
+ case Binding.WILDCARD_TYPE :
+ case Binding.INTERSECTION_TYPE :
+ return ((WildcardBinding) type).resolve();
+-
++
+ case Binding.ARRAY_TYPE :
+- resolveType(((ArrayBinding) type).leafComponentType, environment, parameterizedType, rank);
++ resolveType(((ArrayBinding) type).leafComponentType, environment, convertGenericToRawType);
+ break;
+-
++
+ case Binding.TYPE_PARAMETER :
+- ((TypeVariableBinding) type).resolve(environment);
++ ((TypeVariableBinding) type).resolve();
+ break;
+-
++
+ case Binding.GENERIC_TYPE :
+- if (parameterizedType == null) // raw reference to generic ?
++ if (convertGenericToRawType) // raw reference to generic ?
+ return environment.convertUnresolvedBinaryToRawType(type);
+ break;
+-
+- default:
++
++ default:
+ if (type instanceof UnresolvedReferenceBinding)
+- return ((UnresolvedReferenceBinding) type).resolve(environment, parameterizedType == null);
++ return ((UnresolvedReferenceBinding) type).resolve(environment, convertGenericToRawType);
++ if (convertGenericToRawType) // raw reference to generic ?
++ return environment.convertUnresolvedBinaryToRawType(type);
++ break;
+ }
+ return type;
+ }
+@@ -173,7 +160,7 @@
+
+ if ((binaryType.getTagBits() & TagBits.HierarchyHasProblems) != 0)
+ this.tagBits |= TagBits.HierarchyHasProblems;
+-
++
+ if (binaryType.isAnonymous()) {
+ this.tagBits |= TagBits.AnonymousTypeMask;
+ } else if (binaryType.isLocal()) {
+@@ -188,11 +175,11 @@
+ this.enclosingType = environment.getTypeFromConstantPoolName(enclosingTypeName, 0, -1, true, null /* could not be missing */); // pretend parameterized to avoid raw
+ this.tagBits |= TagBits.MemberTypeMask; // must be a member type not a top-level or local type
+ this.tagBits |= TagBits.HasUnresolvedEnclosingType;
+- if (this.enclosingType().isStrictfp())
++ if (enclosingType().isStrictfp())
+ this.modifiers |= ClassFileConstants.AccStrictfp;
+- if (this.enclosingType().isDeprecated())
++ if (enclosingType().isDeprecated())
+ this.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
+- }
++ }
+ }
+
+ /**
+@@ -200,7 +187,7 @@
+ */
+ public FieldBinding[] availableFields() {
+ if ((this.tagBits & TagBits.AreFieldsComplete) != 0)
+- return fields;
++ return this.fields;
+
+ // lazily sort fields
+ if ((this.tagBits & TagBits.AreFieldsSorted) == 0) {
+@@ -209,11 +196,11 @@
+ ReferenceBinding.sortFields(this.fields, 0, length);
+ this.tagBits |= TagBits.AreFieldsSorted;
+ }
+- FieldBinding[] availableFields = new FieldBinding[fields.length];
++ FieldBinding[] availableFields = new FieldBinding[this.fields.length];
+ int count = 0;
+- for (int i = 0; i < fields.length; i++) {
++ for (int i = 0; i < this.fields.length; i++) {
+ try {
+- availableFields[count] = resolveTypeFor(fields[i]);
++ availableFields[count] = resolveTypeFor(this.fields[i]);
+ count++;
+ } catch (AbortCompilation a){
+ // silent abort
+@@ -229,7 +216,7 @@
+ */
+ public MethodBinding[] availableMethods() {
+ if ((this.tagBits & TagBits.AreMethodsComplete) != 0)
+- return methods;
++ return this.methods;
+
+ // lazily sort methods
+ if ((this.tagBits & TagBits.AreMethodsSorted) == 0) {
+@@ -238,11 +225,11 @@
+ ReferenceBinding.sortMethods(this.methods, 0, length);
+ this.tagBits |= TagBits.AreMethodsSorted;
+ }
+- MethodBinding[] availableMethods = new MethodBinding[methods.length];
++ MethodBinding[] availableMethods = new MethodBinding[this.methods.length];
+ int count = 0;
+- for (int i = 0; i < methods.length; i++) {
++ for (int i = 0; i < this.methods.length; i++) {
+ try {
+- availableMethods[count] = resolveTypesFor(methods[i]);
++ availableMethods[count] = resolveTypesFor(this.methods[i]);
+ count++;
+ } catch (AbortCompilation a){
+ // silent abort
+@@ -252,93 +239,120 @@
+ System.arraycopy(availableMethods, 0, availableMethods = new MethodBinding[count], 0, count);
+ return availableMethods;
+ }
++
+ void cachePartsFrom(IBinaryType binaryType, boolean needFieldsAndMethods) {
+- // default initialization for super-interfaces early, in case some aborting compilation error occurs,
+- // and still want to use binaries passed that point (e.g. type hierarchy resolver, see bug 63748).
+- this.typeVariables = Binding.NO_TYPE_VARIABLES;
+- this.superInterfaces = Binding.NO_SUPERINTERFACES;
+-
+- // must retrieve member types in case superclass/interfaces need them
+- this.memberTypes = Binding.NO_MEMBER_TYPES;
+- IBinaryNestedType[] memberTypeStructures = binaryType.getMemberTypes();
+- if (memberTypeStructures != null) {
+- int size = memberTypeStructures.length;
+- if (size > 0) {
+- this.memberTypes = new ReferenceBinding[size];
+- for (int i = 0; i < size; i++)
+- // attempt to find each member type if it exists in the cache (otherwise - resolve it when requested)
+- this.memberTypes[i] = environment.getTypeFromConstantPoolName(memberTypeStructures[i].getName(), 0, -1, false, null /* could not be missing */);
+- this.tagBits |= TagBits.HasUnresolvedMemberTypes;
++ try {
++ // default initialization for super-interfaces early, in case some aborting compilation error occurs,
++ // and still want to use binaries passed that point (e.g. type hierarchy resolver, see bug 63748).
++ this.typeVariables = Binding.NO_TYPE_VARIABLES;
++ this.superInterfaces = Binding.NO_SUPERINTERFACES;
++
++ // must retrieve member types in case superclass/interfaces need them
++ this.memberTypes = Binding.NO_MEMBER_TYPES;
++ IBinaryNestedType[] memberTypeStructures = binaryType.getMemberTypes();
++ if (memberTypeStructures != null) {
++ int size = memberTypeStructures.length;
++ if (size > 0) {
++ this.memberTypes = new ReferenceBinding[size];
++ for (int i = 0; i < size; i++)
++ // attempt to find each member type if it exists in the cache (otherwise - resolve it when requested)
++ this.memberTypes[i] = this.environment.getTypeFromConstantPoolName(memberTypeStructures[i].getName(), 0, -1, false, null /* could not be missing */);
++ this.tagBits |= TagBits.HasUnresolvedMemberTypes;
++ }
+ }
+- }
+
+-
+- long sourceLevel = environment.globalOptions.sourceLevel;
+- char[] typeSignature = null;
+- if (sourceLevel >= ClassFileConstants.JDK1_5) {
+- typeSignature = binaryType.getGenericSignature();
+- this.tagBits |= binaryType.getTagBits();
+- }
+- char[][][] missingTypeNames = binaryType.getMissingTypeNames();
+- if (typeSignature == null) {
+- char[] superclassName = binaryType.getSuperclassName();
+- if (superclassName != null) {
++ long sourceLevel = this.environment.globalOptions.sourceLevel;
++ char[] typeSignature = null;
++ if (sourceLevel >= ClassFileConstants.JDK1_5) {
++ typeSignature = binaryType.getGenericSignature();
++ this.tagBits |= binaryType.getTagBits();
++ }
++ char[][][] missingTypeNames = binaryType.getMissingTypeNames();
++ if (typeSignature == null) {
++ char[] superclassName = binaryType.getSuperclassName();
++ if (superclassName != null) {
++ // attempt to find the superclass if it exists in the cache (otherwise - resolve it when requested)
++ this.superclass = this.environment.getTypeFromConstantPoolName(superclassName, 0, -1, false, missingTypeNames);
++ this.tagBits |= TagBits.HasUnresolvedSuperclass;
++ }
++
++ this.superInterfaces = Binding.NO_SUPERINTERFACES;
++ char[][] interfaceNames = binaryType.getInterfaceNames();
++ if (interfaceNames != null) {
++ int size = interfaceNames.length;
++ if (size > 0) {
++ this.superInterfaces = new ReferenceBinding[size];
++ for (int i = 0; i < size; i++)
++ // attempt to find each superinterface if it exists in the cache (otherwise - resolve it when requested)
++ this.superInterfaces[i] = this.environment.getTypeFromConstantPoolName(interfaceNames[i], 0, -1, false, missingTypeNames);
++ this.tagBits |= TagBits.HasUnresolvedSuperinterfaces;
++ }
++ }
++ } else {
++ // ClassSignature = ParameterPart(optional) super_TypeSignature interface_signature
++ SignatureWrapper wrapper = new SignatureWrapper(typeSignature);
++ if (wrapper.signature[wrapper.start] == '<') {
++ // ParameterPart = '<' ParameterSignature(s) '>'
++ wrapper.start++; // skip '<'
++ this.typeVariables = createTypeVariables(wrapper, true, missingTypeNames);
++ wrapper.start++; // skip '>'
++ this.tagBits |= TagBits.HasUnresolvedTypeVariables;
++ this.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
++ }
++ TypeVariableBinding[] typeVars = Binding.NO_TYPE_VARIABLES;
++ char[] methodDescriptor = binaryType.getEnclosingMethod();
++ if (methodDescriptor != null) {
++ MethodBinding enclosingMethod = findMethod(methodDescriptor, missingTypeNames);
++ typeVars = enclosingMethod.typeVariables;
++ }
++
+ // attempt to find the superclass if it exists in the cache (otherwise - resolve it when requested)
+- this.superclass = environment.getTypeFromConstantPoolName(superclassName, 0, -1, false, missingTypeNames);
++ this.superclass = (ReferenceBinding) this.environment.getTypeFromTypeSignature(wrapper, typeVars, this, missingTypeNames);
+ this.tagBits |= TagBits.HasUnresolvedSuperclass;
+- }
+
+- this.superInterfaces = Binding.NO_SUPERINTERFACES;
+- char[][] interfaceNames = binaryType.getInterfaceNames();
+- if (interfaceNames != null) {
+- int size = interfaceNames.length;
+- if (size > 0) {
+- this.superInterfaces = new ReferenceBinding[size];
+- for (int i = 0; i < size; i++)
+- // attempt to find each superinterface if it exists in the cache (otherwise - resolve it when requested)
+- this.superInterfaces[i] = environment.getTypeFromConstantPoolName(interfaceNames[i], 0, -1, false, missingTypeNames);
++ this.superInterfaces = Binding.NO_SUPERINTERFACES;
++ if (!wrapper.atEnd()) {
++ // attempt to find each superinterface if it exists in the cache (otherwise - resolve it when requested)
++ java.util.ArrayList types = new java.util.ArrayList(2);
++ do {
++ types.add(this.environment.getTypeFromTypeSignature(wrapper, typeVars, this, missingTypeNames));
++ } while (!wrapper.atEnd());
++ this.superInterfaces = new ReferenceBinding[types.size()];
++ types.toArray(this.superInterfaces);
+ this.tagBits |= TagBits.HasUnresolvedSuperinterfaces;
+ }
+ }
+- } else {
+- // ClassSignature = ParameterPart(optional) super_TypeSignature interface_signature
+- SignatureWrapper wrapper = new SignatureWrapper(typeSignature);
+- if (wrapper.signature[wrapper.start] == '<') {
+- // ParameterPart = '<' ParameterSignature(s) '>'
+- wrapper.start++; // skip '<'
+- this.typeVariables = createTypeVariables(wrapper, true, missingTypeNames);
+- wrapper.start++; // skip '>'
+- this.tagBits |= TagBits.HasUnresolvedTypeVariables;
+- this.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
+- }
+
+- // attempt to find the superclass if it exists in the cache (otherwise - resolve it when requested)
+- this.superclass = (ReferenceBinding) environment.getTypeFromTypeSignature(wrapper, Binding.NO_TYPE_VARIABLES, this, missingTypeNames);
+- this.tagBits |= TagBits.HasUnresolvedSuperclass;
+-
+- this.superInterfaces = Binding.NO_SUPERINTERFACES;
+- if (!wrapper.atEnd()) {
+- // attempt to find each superinterface if it exists in the cache (otherwise - resolve it when requested)
+- java.util.ArrayList types = new java.util.ArrayList(2);
+- do {
+- types.add(environment.getTypeFromTypeSignature(wrapper, Binding.NO_TYPE_VARIABLES, this, missingTypeNames));
+- } while (!wrapper.atEnd());
+- this.superInterfaces = new ReferenceBinding[types.size()];
+- types.toArray(this.superInterfaces);
+- this.tagBits |= TagBits.HasUnresolvedSuperinterfaces;
++ if (needFieldsAndMethods) {
++ createFields(binaryType.getFields(), sourceLevel, missingTypeNames);
++ createMethods(binaryType.getMethods(), sourceLevel, missingTypeNames);
++ boolean isViewedAsDeprecated = isViewedAsDeprecated();
++ if (isViewedAsDeprecated) {
++ for (int i = 0, max = this.fields.length; i < max; i++) {
++ FieldBinding field = this.fields[i];
++ if (!field.isDeprecated()) {
++ field.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
++ }
++ }
++ for (int i = 0, max = this.methods.length; i < max; i++) {
++ MethodBinding method = this.methods[i];
++ if (!method.isDeprecated()) {
++ method.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
++ }
++ }
++ }
+ }
++ if (this.environment.globalOptions.storeAnnotations)
++ setAnnotations(createAnnotations(binaryType.getAnnotations(), this.environment, missingTypeNames));
++ } finally {
++ // protect against incorrect use of the needFieldsAndMethods flag, see 48459
++ if (this.fields == null)
++ this.fields = Binding.NO_FIELDS;
++ if (this.methods == null)
++ this.methods = Binding.NO_METHODS;
+ }
+-
+- if (needFieldsAndMethods) {
+- createFields(binaryType.getFields(), sourceLevel, missingTypeNames);
+- createMethods(binaryType.getMethods(), sourceLevel, missingTypeNames);
+- } else { // protect against incorrect use of the needFieldsAndMethods flag, see 48459
+- this.fields = Binding.NO_FIELDS;
+- this.methods = Binding.NO_METHODS;
+- }
+- if (this.environment.globalOptions.storeAnnotations)
+- setAnnotations(createAnnotations(binaryType.getAnnotations(), this.environment, missingTypeNames));
+ }
++
+ private void createFields(IBinaryField[] iFields, long sourceLevel, char[][][] missingTypeNames) {
+ this.fields = Binding.NO_FIELDS;
+ if (iFields != null) {
+@@ -346,32 +360,29 @@
+ if (size > 0) {
+ this.fields = new FieldBinding[size];
+ boolean use15specifics = sourceLevel >= ClassFileConstants.JDK1_5;
+- boolean isViewedAsDeprecated = isViewedAsDeprecated();
+ boolean hasRestrictedAccess = hasRestrictedAccess();
+ int firstAnnotatedFieldIndex = -1;
+ for (int i = 0; i < size; i++) {
+ IBinaryField binaryField = iFields[i];
+ char[] fieldSignature = use15specifics ? binaryField.getGenericSignature() : null;
+- TypeBinding type = fieldSignature == null
+- ? environment.getTypeFromSignature(binaryField.getTypeName(), 0, -1, false, this, missingTypeNames)
+- : environment.getTypeFromTypeSignature(new SignatureWrapper(fieldSignature), Binding.NO_TYPE_VARIABLES, this, missingTypeNames);
+- FieldBinding field =
++ TypeBinding type = fieldSignature == null
++ ? this.environment.getTypeFromSignature(binaryField.getTypeName(), 0, -1, false, this, missingTypeNames)
++ : this.environment.getTypeFromTypeSignature(new SignatureWrapper(fieldSignature), Binding.NO_TYPE_VARIABLES, this, missingTypeNames);
++ FieldBinding field =
+ new FieldBinding(
+- binaryField.getName(),
+- type,
+- binaryField.getModifiers() | ExtraCompilerModifiers.AccUnresolved,
+- this,
++ binaryField.getName(),
++ type,
++ binaryField.getModifiers() | ExtraCompilerModifiers.AccUnresolved,
++ this,
+ binaryField.getConstant());
+ if (firstAnnotatedFieldIndex < 0
+- && this.environment.globalOptions.storeAnnotations
++ && this.environment.globalOptions.storeAnnotations
+ && binaryField.getAnnotations() != null) {
+ firstAnnotatedFieldIndex = i;
+ }
+ field.id = i; // ordinal
+ if (use15specifics)
+ field.tagBits |= binaryField.getTagBits();
+- if (isViewedAsDeprecated && !field.isDeprecated())
+- field.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
+ if (hasRestrictedAccess)
+ field.modifiers |= ExtraCompilerModifiers.AccRestrictedAccess;
+ if (fieldSignature != null)
+@@ -388,6 +399,7 @@
+ }
+ }
+ }
++
+ private MethodBinding createMethod(IBinaryMethod method, long sourceLevel, char[][][] missingTypeNames) {
+ int methodModifiers = method.getModifiers() | ExtraCompilerModifiers.AccUnresolved;
+ if (sourceLevel < ClassFileConstants.JDK1_5)
+@@ -395,7 +407,7 @@
+ ReferenceBinding[] exceptions = Binding.NO_EXCEPTIONS;
+ TypeBinding[] parameters = Binding.NO_PARAMETERS;
+ TypeVariableBinding[] typeVars = Binding.NO_TYPE_VARIABLES;
+- AnnotationBinding[][] paramAnnotations = null;
++ AnnotationBinding[][] paramAnnotations = null;
+ TypeBinding returnType = null;
+
+ final boolean use15specifics = sourceLevel >= ClassFileConstants.JDK1_5;
+@@ -404,7 +416,7 @@
+ char[] methodDescriptor = method.getMethodDescriptor(); // of the form (I[Ljava/jang/String;)V
+ int numOfParams = 0;
+ char nextChar;
+- int index = 0; // first character is always '(' so skip it
++ int index = 0; // first character is always '(' so skip it
+ while ((nextChar = methodDescriptor[++index]) != ')') {
+ if (nextChar != '[') {
+ numOfParams++;
+@@ -413,8 +425,18 @@
+ }
+ }
+
+- // Ignore synthetic argument for member types.
+- int startIndex = (method.isConstructor() && isMemberType() && !isStatic()) ? 1 : 0;
++ // Ignore synthetic argument for member types or enum types.
++ int startIndex = 0;
++ if (method.isConstructor()) {
++ if (isMemberType() && !isStatic()) {
++ // enclosing type
++ startIndex++;
++ }
++ if (isEnum()) {
++ // synthetic arguments (String, int)
++ startIndex += 2;
++ }
++ }
+ int size = numOfParams - startIndex;
+ if (size > 0) {
+ parameters = new TypeBinding[size];
+@@ -428,11 +450,11 @@
+ while ((nextChar = methodDescriptor[++end]) != ';'){/*empty*/}
+
+ if (i >= startIndex) { // skip the synthetic arg if necessary
+- parameters[i - startIndex] = environment.getTypeFromSignature(methodDescriptor, index, end, false, this, missingTypeNames);
++ parameters[i - startIndex] = this.environment.getTypeFromSignature(methodDescriptor, index, end, false, this, missingTypeNames);
+ // 'paramAnnotations' line up with 'parameters'
+ // int parameter to method.getParameterAnnotations() include the synthetic arg
+ if (paramAnnotations != null)
+- paramAnnotations[i - startIndex] = createAnnotations(method.getParameterAnnotations(i), this.environment, missingTypeNames);
++ paramAnnotations[i - startIndex] = createAnnotations(method.getParameterAnnotations(i - startIndex), this.environment, missingTypeNames);
+ }
+ index = end + 1;
+ }
+@@ -444,12 +466,12 @@
+ if (size > 0) {
+ exceptions = new ReferenceBinding[size];
+ for (int i = 0; i < size; i++)
+- exceptions[i] = environment.getTypeFromConstantPoolName(exceptionTypes[i], 0, -1, false, missingTypeNames);
++ exceptions[i] = this.environment.getTypeFromConstantPoolName(exceptionTypes[i], 0, -1, false, missingTypeNames);
+ }
+ }
+
+ if (!method.isConstructor())
+- returnType = environment.getTypeFromSignature(methodDescriptor, index + 1, -1, false, this, missingTypeNames); // index is currently pointing at the ')'
++ returnType = this.environment.getTypeFromSignature(methodDescriptor, index + 1, -1, false, this, missingTypeNames); // index is currently pointing at the ')'
+ } else {
+ methodModifiers |= ExtraCompilerModifiers.AccGenericSignature;
+ // MethodTypeSignature = ParameterPart(optional) '(' TypeSignatures ')' return_typeSignature ['^' TypeSignature (optional)]
+@@ -469,7 +491,7 @@
+ } else {
+ java.util.ArrayList types = new java.util.ArrayList(2);
+ while (wrapper.signature[wrapper.start] != ')')
+- types.add(environment.getTypeFromTypeSignature(wrapper, typeVars, this, missingTypeNames));
++ types.add(this.environment.getTypeFromTypeSignature(wrapper, typeVars, this, missingTypeNames));
+ wrapper.start++; // skip ')'
+ int numParam = types.size();
+ parameters = new TypeBinding[numParam];
+@@ -483,14 +505,14 @@
+ }
+
+ // always retrieve return type (for constructors, its V for void - will be ignored)
+- returnType = environment.getTypeFromTypeSignature(wrapper, typeVars, this, missingTypeNames);
++ returnType = this.environment.getTypeFromTypeSignature(wrapper, typeVars, this, missingTypeNames);
+
+ if (!wrapper.atEnd() && wrapper.signature[wrapper.start] == '^') {
+ // attempt to find each exception if it exists in the cache (otherwise - resolve it when requested)
+ java.util.ArrayList types = new java.util.ArrayList(2);
+ do {
+ wrapper.start++; // skip '^'
+- types.add(environment.getTypeFromTypeSignature(wrapper, typeVars, this, missingTypeNames));
++ types.add(this.environment.getTypeFromTypeSignature(wrapper, typeVars, this, missingTypeNames));
+ } while (!wrapper.atEnd() && wrapper.signature[wrapper.start] == '^');
+ exceptions = new ReferenceBinding[types.size()];
+ types.toArray(exceptions);
+@@ -501,7 +523,7 @@
+ if (size > 0) {
+ exceptions = new ReferenceBinding[size];
+ for (int i = 0; i < size; i++)
+- exceptions[i] = environment.getTypeFromConstantPoolName(exceptionTypes[i], 0, -1, false, missingTypeNames);
++ exceptions[i] = this.environment.getTypeFromConstantPoolName(exceptionTypes[i], 0, -1, false, missingTypeNames);
+ }
+ }
+ }
+@@ -514,7 +536,8 @@
+ result.setAnnotations(
+ createAnnotations(method.getAnnotations(), this.environment, missingTypeNames),
+ paramAnnotations,
+- isAnnotationType() ? convertMemberValue(method.getDefaultValue(), this.environment, missingTypeNames) : null);
++ isAnnotationType() ? convertMemberValue(method.getDefaultValue(), this.environment, missingTypeNames) : null,
++ this.environment);
+
+ if (use15specifics)
+ result.tagBits |= method.getTagBits();
+@@ -524,18 +547,20 @@
+ typeVars[i].declaringElement = result;
+ return result;
+ }
++
+ /**
+ * Create method bindings for binary type, filtering out <clinit> and synthetics
+ */
+-private void createMethods(IBinaryMethod[] iMethods, long sourceLevel, char[][][] missingTypeNames) {
++private void createMethods(IBinaryMethod[] iMethods, long sourceLevel, char[][][] missingTypeNames) {
+ if (iMethods == null) {
+ this.methods = this.bridgeMethods = Binding.NO_METHODS;
+ return;
+- }
++ }
++
+ ArrayList<MethodBinding> methodBindings = new ArrayList<MethodBinding>(iMethods.length);
+ ArrayList<MethodBinding> bridgeBindings = new ArrayList<MethodBinding>(iMethods.length);
+ boolean isViewedAsDeprecated = isViewedAsDeprecated();
+- boolean hasRestrictedAccess = hasRestrictedAccess();
++ boolean hasRestrictedAccess = hasRestrictedAccess();
+ boolean discardedClinit = false;
+
+ for (int i = 0; i < iMethods.length; ++i) {
+@@ -568,6 +593,7 @@
+ this.methods = methodBindings.size() == 0 ? Binding.NO_METHODS : methodBindings.toArray(new MethodBinding[methodBindings.size()]);
+ this.bridgeMethods = bridgeBindings.size() == 0 ? Binding.NO_METHODS : bridgeBindings.toArray(new MethodBinding[bridgeBindings.size()]);
+ }
++
+ private TypeVariableBinding[] createTypeVariables(SignatureWrapper wrapper, boolean assignVariables, char[][][] missingTypeNames) {
+ // detect all type variables first
+ char[] typeSignature = wrapper.signature;
+@@ -579,10 +605,10 @@
+ createVariables: {
+ for (int i = 1; i < length; i++) {
+ switch(typeSignature[i]) {
+- case '<' :
++ case '<' :
+ depth++;
+ break;
+- case '>' :
++ case '>' :
+ if (--depth < 0)
+ break createVariables;
+ break;
+@@ -595,7 +621,7 @@
+ pendingVariable = false;
+ int colon = CharOperation.indexOf(':', typeSignature, i);
+ char[] variableName = CharOperation.subarray(typeSignature, i, colon);
+- variables.add(new TypeVariableBinding(variableName, this, rank++));
++ variables.add(new TypeVariableBinding(variableName, this, rank++, this.environment));
+ }
+ }
+ }
+@@ -612,6 +638,7 @@
+ }
+ return result;
+ }
++
+ /* Answer the receiver's enclosing type... null if the receiver is a top level type.
+ *
+ * NOTE: enclosingType of a binary type is resolved when needed
+@@ -621,14 +648,14 @@
+ return this.enclosingType;
+
+ // finish resolving the type
+- this.enclosingType = resolveType(this.enclosingType, this.environment, false);
++ this.enclosingType = (ReferenceBinding) resolveType(this.enclosingType, this.environment, false /* no raw conversion */);
+ this.tagBits &= ~TagBits.HasUnresolvedEnclosingType;
+ return this.enclosingType;
+ }
+ // NOTE: the type of each field of a binary type is resolved when needed
+ public FieldBinding[] fields() {
+ if ((this.tagBits & TagBits.AreFieldsComplete) != 0)
+- return fields;
++ return this.fields;
+
+ // lazily sort fields
+ if ((this.tagBits & TagBits.AreFieldsSorted) == 0) {
+@@ -637,17 +664,59 @@
+ ReferenceBinding.sortFields(this.fields, 0, length);
+ this.tagBits |= TagBits.AreFieldsSorted;
+ }
+- for (int i = fields.length; --i >= 0;)
+- resolveTypeFor(fields[i]);
++ for (int i = this.fields.length; --i >= 0;)
++ resolveTypeFor(this.fields[i]);
+ this.tagBits |= TagBits.AreFieldsComplete;
+- return fields;
++ return this.fields;
++}
++
++private MethodBinding findMethod(char[] methodDescriptor, char[][][] missingTypeNames) {
++ int index = -1;
++ while (methodDescriptor[++index] != '(') {
++ // empty
++ }
++ char[] selector = new char[index];
++ System.arraycopy(methodDescriptor, 0, selector, 0, index);
++ TypeBinding[] parameters = Binding.NO_PARAMETERS;
++ int numOfParams = 0;
++ char nextChar;
++ while ((nextChar = methodDescriptor[++index]) != ')') {
++ if (nextChar != '[') {
++ numOfParams++;
++ if (nextChar == 'L')
++ while ((nextChar = methodDescriptor[++index]) != ';'){/*empty*/}
++ }
++ }
++
++ int startIndex = 0;
++ if (numOfParams > 0) {
++ parameters = new TypeBinding[numOfParams];
++ index = 1;
++ int end = 0; // first character is always '(' so skip it
++ for (int i = 0; i < numOfParams; i++) {
++ while ((nextChar = methodDescriptor[++end]) == '['){/*empty*/}
++ if (nextChar == 'L')
++ while ((nextChar = methodDescriptor[++end]) != ';'){/*empty*/}
++
++ if (i >= startIndex) { // skip the synthetic arg if necessary
++ parameters[i - startIndex] = this.environment.getTypeFromSignature(methodDescriptor, index, end, false, this, missingTypeNames);
++ }
++ index = end + 1;
++ }
++ }
++
++ return CharOperation.equals(selector, TypeConstants.INIT)
++ ? this.enclosingType.getExactConstructor(parameters)
++ : this.enclosingType.getExactMethod(selector, parameters, null);
+ }
++
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#genericTypeSignature()
+ */
+ public char[] genericTypeSignature() {
+ return computeGenericTypeSignature(this.typeVariables);
+ }
++
+ //NOTE: the return type, arg & exception types of each method of a binary type are resolved when needed
+ public MethodBinding getExactConstructor(TypeBinding[] argumentTypes) {
+
+@@ -661,8 +730,8 @@
+ int argCount = argumentTypes.length;
+ long range;
+ if ((range = ReferenceBinding.binarySearch(TypeConstants.INIT, this.methods)) >= 0) {
+- nextMethod: for (int imethod = (int)range, end = (int)(range >> 32); imethod <= end; imethod++) {
+- MethodBinding method = methods[imethod];
++ nextMethod: for (int imethod = (int)range, end = (int)(range >> 32); imethod <= end; imethod++) {
++ MethodBinding method = this.methods[imethod];
+ if (method.parameters.length == argCount) {
+ resolveTypesFor(method);
+ TypeBinding[] toMatch = method.parameters;
+@@ -671,7 +740,7 @@
+ continue nextMethod;
+ return method;
+ }
+- }
++ }
+ }
+ return null;
+ }
+@@ -680,7 +749,7 @@
+ //searches up the hierarchy as long as no potential (but not exact) match was found.
+ public MethodBinding getExactMethod(char[] selector, TypeBinding[] argumentTypes, CompilationUnitScope refScope) {
+ // sender from refScope calls recordTypeReference(this)
+-
++
+ // lazily sort methods
+ if ((this.tagBits & TagBits.AreMethodsSorted) == 0) {
+ int length = this.methods.length;
+@@ -694,8 +763,8 @@
+
+ long range;
+ if ((range = ReferenceBinding.binarySearch(selector, this.methods)) >= 0) {
+- nextMethod: for (int imethod = (int)range, end = (int)(range >> 32); imethod <= end; imethod++) {
+- MethodBinding method = methods[imethod];
++ nextMethod: for (int imethod = (int)range, end = (int)(range >> 32); imethod <= end; imethod++) {
++ MethodBinding method = this.methods[imethod];
+ foundNothing = false; // inner type lookups must know that a method with this name exists
+ if (method.parameters.length == argCount) {
+ resolveTypesFor(method);
+@@ -711,13 +780,13 @@
+ if (isInterface()) {
+ if (superInterfaces().length == 1) { // ensure superinterfaces are resolved before checking
+ if (refScope != null)
+- refScope.recordTypeReference(superInterfaces[0]);
+- return superInterfaces[0].getExactMethod(selector, argumentTypes, refScope);
++ refScope.recordTypeReference(this.superInterfaces[0]);
++ return this.superInterfaces[0].getExactMethod(selector, argumentTypes, refScope);
+ }
+ } else if (superclass() != null) { // ensure superclass is resolved before checking
+ if (refScope != null)
+- refScope.recordTypeReference(superclass);
+- return superclass.getExactMethod(selector, argumentTypes, refScope);
++ refScope.recordTypeReference(this.superclass);
++ return this.superclass.getExactMethod(selector, argumentTypes, refScope);
+ }
+ }
+ return null;
+@@ -745,7 +814,7 @@
+ int prefixLength = this.compoundName[this.compoundName.length - 1].length + 1; // enclosing$
+ if (name.length == (prefixLength + typeName.length)) // enclosing $ typeName
+ if (CharOperation.fragmentEquals(typeName, name, prefixLength, true)) // only check trailing portion
+- return this.memberTypes[i] = resolveType(memberType, this.environment, false); // no raw conversion for now
++ return this.memberTypes[i] = (ReferenceBinding) resolveType(memberType, this.environment, false /* no raw conversion for now */);
+ } else if (CharOperation.equals(typeName, memberType.sourceName)) {
+ return memberType;
+ }
+@@ -761,7 +830,7 @@
+ int length = end - start + 1;
+ if ((this.tagBits & TagBits.AreMethodsComplete) != 0) {
+ // simply clone method subset
+- MethodBinding[] result;
++ MethodBinding[] result;
+ System.arraycopy(this.methods, start, result = new MethodBinding[length], 0, length);
+ return result;
+ }
+@@ -782,18 +851,59 @@
+ MethodBinding[] result = new MethodBinding[length];
+ // iterate methods to resolve them
+ for (int i = start, index = 0; i <= end; i++, index++)
+- result[index] = resolveTypesFor(methods[i]);
++ result[index] = resolveTypesFor(this.methods[i]);
+ return result;
+ }
+ return Binding.NO_METHODS;
+ }
++// Answer methods named selector, which take no more than the suggestedParameterLength.
++// The suggested parameter length is optional and may not be guaranteed by every type.
++public MethodBinding[] getMethods(char[] selector, int suggestedParameterLength) {
++ if ((this.tagBits & TagBits.AreMethodsComplete) != 0)
++ return getMethods(selector);
++ // lazily sort methods
++ if ((this.tagBits & TagBits.AreMethodsSorted) == 0) {
++ int length = this.methods.length;
++ if (length > 1)
++ ReferenceBinding.sortMethods(this.methods, 0, length);
++ this.tagBits |= TagBits.AreMethodsSorted;
++ }
++ long range;
++ if ((range = ReferenceBinding.binarySearch(selector, this.methods)) >= 0) {
++ int start = (int) range, end = (int) (range >> 32);
++ int length = end - start + 1;
++ int count = 0;
++ for (int i = start; i <= end; i++) {
++ int len = this.methods[i].parameters.length;
++ if (len <= suggestedParameterLength || (this.methods[i].isVarargs() && len == suggestedParameterLength + 1))
++ count++;
++ }
++ if (count == 0) {
++ MethodBinding[] result = new MethodBinding[length];
++ // iterate methods to resolve them
++ for (int i = start, index = 0; i <= end; i++)
++ result[index++] = resolveTypesFor(this.methods[i]);
++ return result;
++ } else {
++ MethodBinding[] result = new MethodBinding[count];
++ // iterate methods to resolve them
++ for (int i = start, index = 0; i <= end; i++) {
++ int len = this.methods[i].parameters.length;
++ if (len <= suggestedParameterLength || (this.methods[i].isVarargs() && len == suggestedParameterLength + 1))
++ result[index++] = resolveTypesFor(this.methods[i]);
++ }
++ return result;
++ }
++ }
++ return Binding.NO_METHODS;
++}
+ public boolean hasMemberTypes() {
+ return this.memberTypes.length > 0;
+ }
+ // NOTE: member types of binary types are resolved when needed
+ public TypeVariableBinding getTypeVariable(char[] variableName) {
+ TypeVariableBinding variable = super.getTypeVariable(variableName);
+- variable.resolve(this.environment);
++ variable.resolve();
+ return variable;
+ }
+ private void initializeTypeVariable(TypeVariableBinding variable, TypeVariableBinding[] existingVariables, SignatureWrapper wrapper, char[][][] missingTypeNames) {
+@@ -804,9 +914,9 @@
+ wrapper.start = colon + 1; // skip name + ':'
+ ReferenceBinding type, firstBound = null;
+ if (wrapper.signature[wrapper.start] == ':') {
+- type = environment.getResolvedType(TypeConstants.JAVA_LANG_OBJECT, null);
++ type = this.environment.getResolvedType(TypeConstants.JAVA_LANG_OBJECT, null);
+ } else {
+- type = (ReferenceBinding) environment.getTypeFromTypeSignature(wrapper, existingVariables, this, missingTypeNames);
++ type = (ReferenceBinding) this.environment.getTypeFromTypeSignature(wrapper, existingVariables, this, missingTypeNames);
+ firstBound = type;
+ }
+
+@@ -819,7 +929,7 @@
+ java.util.ArrayList types = new java.util.ArrayList(2);
+ do {
+ wrapper.start++; // skip ':'
+- types.add(environment.getTypeFromTypeSignature(wrapper, existingVariables, this, missingTypeNames));
++ types.add(this.environment.getTypeFromTypeSignature(wrapper, existingVariables, this, missingTypeNames));
+ } while (wrapper.signature[wrapper.start] == ':');
+ bounds = new ReferenceBinding[types.size()];
+ types.toArray(bounds);
+@@ -850,6 +960,9 @@
+ public boolean isGenericType() {
+ return this.typeVariables != Binding.NO_TYPE_VARIABLES;
+ }
++public boolean isHierarchyConnected() {
++ return (this.tagBits & (TagBits.HasUnresolvedSuperclass | TagBits.HasUnresolvedSuperinterfaces)) == 0;
++}
+ public int kind() {
+ if (this.typeVariables != Binding.NO_TYPE_VARIABLES)
+ return Binding.GENERIC_TYPE;
+@@ -861,7 +974,7 @@
+ return this.memberTypes;
+
+ for (int i = this.memberTypes.length; --i >= 0;)
+- this.memberTypes[i] = resolveType(this.memberTypes[i], this.environment, false); // no raw conversion for now
++ this.memberTypes[i] = (ReferenceBinding) resolveType(this.memberTypes[i], this.environment, false /* no raw conversion for now */);
+ this.tagBits &= ~TagBits.HasUnresolvedMemberTypes;
+ return this.memberTypes;
+ }
+@@ -880,15 +993,15 @@
+ ReferenceBinding.sortMethods(this.bridgeMethods, 0, length);
+ this.tagBits |= TagBits.AreMethodsSorted;
+ }
+- for (int i = methods.length; --i >= 0;)
+- resolveTypesFor(methods[i]);
+- for (int i = bridgeMethods.length; --i >= 0;)
+- resolveTypesFor(bridgeMethods[i]);
+- this.tagBits |= TagBits.AreMethodsComplete;
++ for (int i = this.methods.length; --i >= 0;)
++ resolveTypesFor(this.methods[i]);
++ for (int i = this.bridgeMethods.length; --i >= 0;)
++ resolveTypesFor(this.bridgeMethods[i]);
++ this.tagBits |= TagBits.AreMethodsComplete;
+ }
+ public MethodBinding[] methods() {
+ lazyInitMethods();
+- return methods;
++ return this.methods;
+ }
+ public MethodBinding[] bridgeMethods() {
+ lazyInitMethods();
+@@ -898,11 +1011,11 @@
+ if ((field.modifiers & ExtraCompilerModifiers.AccUnresolved) == 0)
+ return field;
+
+- TypeBinding resolvedType = resolveType(field.type, this.environment, null, 0);
++ TypeBinding resolvedType = resolveType(field.type, this.environment, true /* raw conversion */);
+ field.type = resolvedType;
+ if ((resolvedType.tagBits & TagBits.HasMissingType) != 0) {
+ field.tagBits |= TagBits.HasMissingType;
+- }
++ }
+ field.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;
+ return field;
+ }
+@@ -911,28 +1024,28 @@
+ return method;
+
+ if (!method.isConstructor()) {
+- TypeBinding resolvedType = resolveType(method.returnType, this.environment, null, 0);
++ TypeBinding resolvedType = resolveType(method.returnType, this.environment, true /* raw conversion */);
+ method.returnType = resolvedType;
+ if ((resolvedType.tagBits & TagBits.HasMissingType) != 0) {
+ method.tagBits |= TagBits.HasMissingType;
+- }
++ }
+ }
+ for (int i = method.parameters.length; --i >= 0;) {
+- TypeBinding resolvedType = resolveType(method.parameters[i], this.environment, null, 0);
++ TypeBinding resolvedType = resolveType(method.parameters[i], this.environment, true /* raw conversion */);
+ method.parameters[i] = resolvedType;
+ if ((resolvedType.tagBits & TagBits.HasMissingType) != 0) {
+ method.tagBits |= TagBits.HasMissingType;
+- }
++ }
+ }
+ for (int i = method.thrownExceptions.length; --i >= 0;) {
+- ReferenceBinding resolvedType = resolveType(method.thrownExceptions[i], this.environment, true);
++ ReferenceBinding resolvedType = (ReferenceBinding) resolveType(method.thrownExceptions[i], this.environment, true /* raw conversion */);
+ method.thrownExceptions[i] = resolvedType;
+ if ((resolvedType.tagBits & TagBits.HasMissingType) != 0) {
+ method.tagBits |= TagBits.HasMissingType;
+ }
+ }
+ for (int i = method.typeVariables.length; --i >= 0;) {
+- method.typeVariables[i].resolve(this.environment);
++ method.typeVariables[i].resolve();
+ }
+ method.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;
+ return method;
+@@ -957,7 +1070,7 @@
+ return this.superclass;
+
+ // finish resolving the type
+- this.superclass = resolveType(this.superclass, this.environment, true);
++ this.superclass = (ReferenceBinding) resolveType(this.superclass, this.environment, true /* raw conversion */);
+ this.tagBits &= ~TagBits.HasUnresolvedSuperclass;
+ if (this.superclass.problemId() == ProblemReasons.NotFound)
+ this.tagBits |= TagBits.HierarchyHasProblems; // propagate type inconsistency
+@@ -969,7 +1082,7 @@
+ return this.superInterfaces;
+
+ for (int i = this.superInterfaces.length; --i >= 0;) {
+- this.superInterfaces[i] = resolveType(this.superInterfaces[i], this.environment, true);
++ this.superInterfaces[i] = (ReferenceBinding) resolveType(this.superInterfaces[i], this.environment, true /* raw conversion */);
+ if (this.superInterfaces[i].problemId() == ProblemReasons.NotFound)
+ this.tagBits |= TagBits.HierarchyHasProblems; // propagate type inconsistency
+ }
+@@ -981,7 +1094,7 @@
+ return this.typeVariables;
+
+ for (int i = this.typeVariables.length; --i >= 0;)
+- this.typeVariables[i].resolve(this.environment);
++ this.typeVariables[i].resolve();
+ this.tagBits &= ~TagBits.HasUnresolvedTypeVariables;
+ return this.typeVariables;
+ }
+@@ -999,8 +1112,8 @@
+ if (isEnum()) buffer.append("enum "); //$NON-NLS-1$
+ else if (isAnnotationType()) buffer.append("@interface "); //$NON-NLS-1$
+ else if (isClass()) buffer.append("class "); //$NON-NLS-1$
+- else buffer.append("interface "); //$NON-NLS-1$
+- buffer.append((compoundName != null) ? CharOperation.toString(compoundName) : "UNNAMED TYPE"); //$NON-NLS-1$
++ else buffer.append("interface "); //$NON-NLS-1$
++ buffer.append((this.compoundName != null) ? CharOperation.toString(this.compoundName) : "UNNAMED TYPE"); //$NON-NLS-1$
+
+ if (this.typeVariables == null) {
+ buffer.append("<NULL TYPE VARIABLES>"); //$NON-NLS-1$
+@@ -1018,51 +1131,51 @@
+ buffer.append(">"); //$NON-NLS-1$
+ }
+ buffer.append("\n\textends "); //$NON-NLS-1$
+- buffer.append((superclass != null) ? superclass.debugName() : "NULL TYPE"); //$NON-NLS-1$
++ buffer.append((this.superclass != null) ? this.superclass.debugName() : "NULL TYPE"); //$NON-NLS-1$
+
+- if (superInterfaces != null) {
+- if (superInterfaces != Binding.NO_SUPERINTERFACES) {
++ if (this.superInterfaces != null) {
++ if (this.superInterfaces != Binding.NO_SUPERINTERFACES) {
+ buffer.append("\n\timplements : "); //$NON-NLS-1$
+- for (int i = 0, length = superInterfaces.length; i < length; i++) {
++ for (int i = 0, length = this.superInterfaces.length; i < length; i++) {
+ if (i > 0)
+ buffer.append(", "); //$NON-NLS-1$
+- buffer.append((superInterfaces[i] != null) ? superInterfaces[i].debugName() : "NULL TYPE"); //$NON-NLS-1$
++ buffer.append((this.superInterfaces[i] != null) ? this.superInterfaces[i].debugName() : "NULL TYPE"); //$NON-NLS-1$
+ }
+ }
+ } else {
+ buffer.append("NULL SUPERINTERFACES"); //$NON-NLS-1$
+ }
+
+- if (enclosingType != null) {
++ if (this.enclosingType != null) {
+ buffer.append("\n\tenclosing type : "); //$NON-NLS-1$
+- buffer.append(enclosingType.debugName());
++ buffer.append(this.enclosingType.debugName());
+ }
+
+- if (fields != null) {
+- if (fields != Binding.NO_FIELDS) {
++ if (this.fields != null) {
++ if (this.fields != Binding.NO_FIELDS) {
+ buffer.append("\n/* fields */"); //$NON-NLS-1$
+- for (int i = 0, length = fields.length; i < length; i++)
+- buffer.append((fields[i] != null) ? "\n" + fields[i].toString() : "\nNULL FIELD"); //$NON-NLS-1$ //$NON-NLS-2$
++ for (int i = 0, length = this.fields.length; i < length; i++)
++ buffer.append((this.fields[i] != null) ? "\n" + this.fields[i].toString() : "\nNULL FIELD"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ } else {
+ buffer.append("NULL FIELDS"); //$NON-NLS-1$
+ }
+
+- if (methods != null) {
+- if (methods != Binding.NO_METHODS) {
++ if (this.methods != null) {
++ if (this.methods != Binding.NO_METHODS) {
+ buffer.append("\n/* methods */"); //$NON-NLS-1$
+- for (int i = 0, length = methods.length; i < length; i++)
+- buffer.append((methods[i] != null) ? "\n" + methods[i].toString() : "\nNULL METHOD"); //$NON-NLS-1$ //$NON-NLS-2$
++ for (int i = 0, length = this.methods.length; i < length; i++)
++ buffer.append((this.methods[i] != null) ? "\n" + this.methods[i].toString() : "\nNULL METHOD"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ } else {
+ buffer.append("NULL METHODS"); //$NON-NLS-1$
+ }
+
+- if (memberTypes != null) {
+- if (memberTypes != Binding.NO_MEMBER_TYPES) {
++ if (this.memberTypes != null) {
++ if (this.memberTypes != Binding.NO_MEMBER_TYPES) {
+ buffer.append("\n/* members */"); //$NON-NLS-1$
+- for (int i = 0, length = memberTypes.length; i < length; i++)
+- buffer.append((memberTypes[i] != null) ? "\n" + memberTypes[i].toString() : "\nNULL TYPE"); //$NON-NLS-1$ //$NON-NLS-2$
++ for (int i = 0, length = this.memberTypes.length; i < length; i++)
++ buffer.append((this.memberTypes[i] != null) ? "\n" + this.memberTypes[i].toString() : "\nNULL TYPE"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ } else {
+ buffer.append("NULL MEMBER TYPES"); //$NON-NLS-1$
+@@ -1072,6 +1185,6 @@
+ return buffer.toString();
+ }
+ MethodBinding[] unResolvedMethods() { // for the MethodVerifier so it doesn't resolve types
+- return methods;
++ return this.methods;
+ }
+ }
+Index: gwt-debian/dev/core/src/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java
+===================================================================
+--- gwt-debian.orig/dev/core/src/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java 2011-12-21 11:43:29.177246756 +0100
++++ gwt-debian/dev/core/src/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java 2011-12-21 11:44:39.317245930 +0100
+@@ -1,5 +1,5 @@
+ /*******************************************************************************
+- * Copyright (c) 2000, 2008 IBM Corporation and others.
++ * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+@@ -20,65 +20,66 @@
+ import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+ import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
+ import org.eclipse.jdt.internal.compiler.codegen.ConstantPool;
++import org.eclipse.jdt.internal.compiler.util.Util;
+
+ public class MethodBinding extends Binding {
+-
+- public int modifiers;
+- public char[] selector;
+- public TypeBinding returnType;
+- public TypeBinding[] parameters;
+- public ReferenceBinding[] thrownExceptions;
+- public ReferenceBinding declaringClass;
+- public TypeVariableBinding[] typeVariables = Binding.NO_TYPE_VARIABLES;
+- char[] signature;
+- public long tagBits;
+-
++
++ public int modifiers;
++ public char[] selector;
++ public TypeBinding returnType;
++ public TypeBinding[] parameters;
++ public ReferenceBinding[] thrownExceptions;
++ public ReferenceBinding declaringClass;
++ public TypeVariableBinding[] typeVariables = Binding.NO_TYPE_VARIABLES;
++ char[] signature;
++ public long tagBits;
++
+ protected MethodBinding() {
+- // for creating problem or synthetic method
++ // for creating problem or synthetic method
+ }
+ public MethodBinding(int modifiers, char[] selector, TypeBinding returnType, TypeBinding[] parameters, ReferenceBinding[] thrownExceptions, ReferenceBinding declaringClass) {
+- this.modifiers = modifiers;
+- this.selector = selector;
+- this.returnType = returnType;
+- this.parameters = (parameters == null || parameters.length == 0) ? Binding.NO_PARAMETERS : parameters;
+- this.thrownExceptions = (thrownExceptions == null || thrownExceptions.length == 0) ? Binding.NO_EXCEPTIONS : thrownExceptions;
+- this.declaringClass = declaringClass;
+-
+- // propagate the strictfp & deprecated modifiers
+- if (this.declaringClass != null) {
+- if (this.declaringClass.isStrictfp())
+- if (!(isNative() || isAbstract()))
+- this.modifiers |= ClassFileConstants.AccStrictfp;
+- }
++ this.modifiers = modifiers;
++ this.selector = selector;
++ this.returnType = returnType;
++ this.parameters = (parameters == null || parameters.length == 0) ? Binding.NO_PARAMETERS : parameters;
++ this.thrownExceptions = (thrownExceptions == null || thrownExceptions.length == 0) ? Binding.NO_EXCEPTIONS : thrownExceptions;
++ this.declaringClass = declaringClass;
++
++ // propagate the strictfp & deprecated modifiers
++ if (this.declaringClass != null) {
++ if (this.declaringClass.isStrictfp())
++ if (!(isNative() || isAbstract()))
++ this.modifiers |= ClassFileConstants.AccStrictfp;
++ }
+ }
+ public MethodBinding(int modifiers, TypeBinding[] parameters, ReferenceBinding[] thrownExceptions, ReferenceBinding declaringClass) {
+- this(modifiers, TypeConstants.INIT, TypeBinding.VOID, parameters, thrownExceptions, declaringClass);
++ this(modifiers, TypeConstants.INIT, TypeBinding.VOID, parameters, thrownExceptions, declaringClass);
+ }
+ // special API used to change method declaring class for runtime visibility check
+ public MethodBinding(MethodBinding initialMethodBinding, ReferenceBinding declaringClass) {
+- this.modifiers = initialMethodBinding.modifiers;
+- this.selector = initialMethodBinding.selector;
+- this.returnType = initialMethodBinding.returnType;
+- this.parameters = initialMethodBinding.parameters;
+- this.thrownExceptions = initialMethodBinding.thrownExceptions;
+- this.declaringClass = declaringClass;
+- declaringClass.storeAnnotationHolder(this, initialMethodBinding.declaringClass.retrieveAnnotationHolder(initialMethodBinding, true));
++ this.modifiers = initialMethodBinding.modifiers;
++ this.selector = initialMethodBinding.selector;
++ this.returnType = initialMethodBinding.returnType;
++ this.parameters = initialMethodBinding.parameters;
++ this.thrownExceptions = initialMethodBinding.thrownExceptions;
++ this.declaringClass = declaringClass;
++ declaringClass.storeAnnotationHolder(this, initialMethodBinding.declaringClass.retrieveAnnotationHolder(initialMethodBinding, true));
+ }
+ /* Answer true if the argument types & the receiver's parameters have the same erasure
+ */
+ public final boolean areParameterErasuresEqual(MethodBinding method) {
+- TypeBinding[] args = method.parameters;
+- if (parameters == args)
+- return true;
+-
+- int length = parameters.length;
+- if (length != args.length)
+- return false;
+-
+- for (int i = 0; i < length; i++)
+- if (parameters[i] != args[i] && parameters[i].erasure() != args[i].erasure())
+- return false;
+- return true;
++ TypeBinding[] args = method.parameters;
++ if (this.parameters == args)
++ return true;
++
++ int length = this.parameters.length;
++ if (length != args.length)
++ return false;
++
++ for (int i = 0; i < length; i++)
++ if (this.parameters[i] != args[i] && this.parameters[i].erasure() != args[i].erasure())
++ return false;
++ return true;
+ }
+ /*
+ * Returns true if given parameters are compatible with this method parameters.
+@@ -86,46 +87,46 @@
+ * passed as argument matches this MethodBinding number of parameters
+ */
+ public final boolean areParametersCompatibleWith(TypeBinding[] arguments) {
+- int paramLength = this.parameters.length;
+- int argLength = arguments.length;
+- int lastIndex = argLength;
+- if (isVarargs()) {
+- lastIndex = paramLength - 1;
+- if (paramLength == argLength) { // accept X[] but not X or X[][]
+- TypeBinding varArgType = parameters[lastIndex]; // is an ArrayBinding by definition
+- TypeBinding lastArgument = arguments[lastIndex];
+- if (varArgType != lastArgument && !lastArgument.isCompatibleWith(varArgType))
+- return false;
+- } else if (paramLength < argLength) { // all remainig argument types must be compatible with the elementsType of varArgType
+- TypeBinding varArgType = ((ArrayBinding) parameters[lastIndex]).elementsType();
+- for (int i = lastIndex; i < argLength; i++)
+- if (varArgType != arguments[i] && !arguments[i].isCompatibleWith(varArgType))
+- return false;
+- } else if (lastIndex != argLength) { // can call foo(int i, X ... x) with foo(1) but NOT foo();
+- return false;
+- }
+- // now compare standard arguments from 0 to lastIndex
+- }
+- for (int i = 0; i < lastIndex; i++)
+- if (parameters[i] != arguments[i] && !arguments[i].isCompatibleWith(parameters[i]))
+- return false;
+- return true;
++ int paramLength = this.parameters.length;
++ int argLength = arguments.length;
++ int lastIndex = argLength;
++ if (isVarargs()) {
++ lastIndex = paramLength - 1;
++ if (paramLength == argLength) { // accept X[] but not X or X[][]
++ TypeBinding varArgType = this.parameters[lastIndex]; // is an ArrayBinding by definition
++ TypeBinding lastArgument = arguments[lastIndex];
++ if (varArgType != lastArgument && !lastArgument.isCompatibleWith(varArgType))
++ return false;
++ } else if (paramLength < argLength) { // all remainig argument types must be compatible with the elementsType of varArgType
++ TypeBinding varArgType = ((ArrayBinding) this.parameters[lastIndex]).elementsType();
++ for (int i = lastIndex; i < argLength; i++)
++ if (varArgType != arguments[i] && !arguments[i].isCompatibleWith(varArgType))
++ return false;
++ } else if (lastIndex != argLength) { // can call foo(int i, X ... x) with foo(1) but NOT foo();
++ return false;
++ }
++ // now compare standard arguments from 0 to lastIndex
++ }
++ for (int i = 0; i < lastIndex; i++)
++ if (this.parameters[i] != arguments[i] && !arguments[i].isCompatibleWith(this.parameters[i]))
++ return false;
++ return true;
+ }
+ /* Answer true if the argument types & the receiver's parameters are equal
+ */
+ public final boolean areParametersEqual(MethodBinding method) {
+- TypeBinding[] args = method.parameters;
+- if (parameters == args)
+- return true;
+-
+- int length = parameters.length;
+- if (length != args.length)
+- return false;
+-
+- for (int i = 0; i < length; i++)
+- if (parameters[i] != args[i])
+- return false;
+- return true;
++ TypeBinding[] args = method.parameters;
++ if (this.parameters == args)
++ return true;
++
++ int length = this.parameters.length;
++ if (length != args.length)
++ return false;
++
++ for (int i = 0; i < length; i++)
++ if (this.parameters[i] != args[i])
++ return false;
++ return true;
+ }
+
+ /* API
+@@ -135,18 +136,41 @@
+ /* Answer true if the type variables have the same erasure
+ */
+ public final boolean areTypeVariableErasuresEqual(MethodBinding method) {
+- TypeVariableBinding[] vars = method.typeVariables;
+- if (this.typeVariables == vars)
+- return true;
+-
+- int length = this.typeVariables.length;
+- if (length != vars.length)
+- return false;
+-
+- for (int i = 0; i < length; i++)
+- if (this.typeVariables[i] != vars[i] && this.typeVariables[i].erasure() != vars[i].erasure())
+- return false;
+- return true;
++ TypeVariableBinding[] vars = method.typeVariables;
++ if (this.typeVariables == vars)
++ return true;
++
++ int length = this.typeVariables.length;
++ if (length != vars.length)
++ return false;
++
++ for (int i = 0; i < length; i++)
++ if (this.typeVariables[i] != vars[i] && this.typeVariables[i].erasure() != vars[i].erasure())
++ return false;
++ return true;
++}
++MethodBinding asRawMethod(LookupEnvironment env) {
++ if (this.typeVariables == Binding.NO_TYPE_VARIABLES) return this;
++
++ // substitute type arguments with raw types
++ int length = this.typeVariables.length;
++ TypeBinding[] arguments = new TypeBinding[length];
++ for (int i = 0; i < length; i++) {
++ TypeVariableBinding var = this.typeVariables[i];
++ if (var.boundsCount() <= 1) {
++ arguments[i] = env.convertToRawType(var.upperBound(), false /*do not force conversion of enclosing types*/);
++ } else {
++ // use an intersection type to retain full bound information if more than 1 bound
++ TypeBinding rawSuperclass = env.convertToRawType(var.superclass(), false);
++ TypeBinding[] itsSuperinterfaces = var.superInterfaces();
++ int superLength = itsSuperinterfaces.length;
++ TypeBinding[] rawSuperinterfaces = new TypeBinding[superLength];
++ for (int s = 0; s < superLength; s++)
++ rawSuperinterfaces[s] = env.convertToRawType(itsSuperinterfaces[s], false);
++ arguments[i] = env.createWildcard(null, 0, rawSuperclass, rawSuperinterfaces, org.eclipse.jdt.internal.compiler.ast.Wildcard.EXTENDS);
++ }
++ }
++ return env.createParameterizedGenericMethod(this, arguments);
+ }
+ /* Answer true if the receiver is visible to the type provided by the scope.
+ * InvocationSite implements isSuperAccess() to provide additional information
+@@ -158,45 +182,45 @@
+ */
+
+ public final boolean canBeSeenBy(InvocationSite invocationSite, Scope scope) {
+- if (isPublic()) return true;
+-
+- SourceTypeBinding invocationType = scope.enclosingSourceType();
+- if (invocationType == declaringClass) return true;
++ if (isPublic()) return true;
+
+- if (isProtected()) {
+- // answer true if the receiver is in the same package as the invocationType
+- if (invocationType.fPackage == declaringClass.fPackage) return true;
+- return invocationSite.isSuperAccess();
+- }
+-
+- if (isPrivate()) {
+- // answer true if the invocationType and the declaringClass have a common enclosingType
+- // already know they are not the identical type
+- ReferenceBinding outerInvocationType = invocationType;
+- ReferenceBinding temp = outerInvocationType.enclosingType();
+- while (temp != null) {
+- outerInvocationType = temp;
+- temp = temp.enclosingType();
+- }
++ SourceTypeBinding invocationType = scope.enclosingSourceType();
++ if (invocationType == this.declaringClass) return true;
+
+- ReferenceBinding outerDeclaringClass = (ReferenceBinding)declaringClass.erasure();
+- temp = outerDeclaringClass.enclosingType();
+- while (temp != null) {
+- outerDeclaringClass = temp;
+- temp = temp.enclosingType();
+- }
+- return outerInvocationType == outerDeclaringClass;
+- }
++ if (isProtected()) {
++ // answer true if the receiver is in the same package as the invocationType
++ if (invocationType.fPackage == this.declaringClass.fPackage) return true;
++ return invocationSite.isSuperAccess();
++ }
++
++ if (isPrivate()) {
++ // answer true if the invocationType and the declaringClass have a common enclosingType
++ // already know they are not the identical type
++ ReferenceBinding outerInvocationType = invocationType;
++ ReferenceBinding temp = outerInvocationType.enclosingType();
++ while (temp != null) {
++ outerInvocationType = temp;
++ temp = temp.enclosingType();
++ }
++
++ ReferenceBinding outerDeclaringClass = (ReferenceBinding)this.declaringClass.erasure();
++ temp = outerDeclaringClass.enclosingType();
++ while (temp != null) {
++ outerDeclaringClass = temp;
++ temp = temp.enclosingType();
++ }
++ return outerInvocationType == outerDeclaringClass;
++ }
+
+- // isDefault()
+- return invocationType.fPackage == declaringClass.fPackage;
++ // isDefault()
++ return invocationType.fPackage == this.declaringClass.fPackage;
+ }
+ public final boolean canBeSeenBy(PackageBinding invocationPackage) {
+- if (isPublic()) return true;
+- if (isPrivate()) return false;
++ if (isPublic()) return true;
++ if (isPrivate()) return false;
+
+- // isProtected() or isDefault()
+- return invocationPackage == declaringClass.getPackage();
++ // isProtected() or isDefault()
++ return invocationPackage == this.declaringClass.getPackage();
+ }
+
+ /* Answer true if the receiver is visible to the type provided by the scope.
+@@ -206,133 +230,134 @@
+ * NOTE: Cannot invoke this method with a compilation unit scope.
+ */
+ public final boolean canBeSeenBy(TypeBinding receiverType, InvocationSite invocationSite, Scope scope) {
+- if (isPublic()) return true;
++ if (isPublic()) return true;
+
+- SourceTypeBinding invocationType = scope.enclosingSourceType();
+- if (invocationType == declaringClass && invocationType == receiverType) return true;
++ SourceTypeBinding invocationType = scope.enclosingSourceType();
++ if (invocationType == this.declaringClass && invocationType == receiverType) return true;
+
+- if (invocationType == null) // static import call
+- return !isPrivate() && scope.getCurrentPackage() == declaringClass.fPackage;
+-
+- if (isProtected()) {
+- // answer true if the invocationType is the declaringClass or they are in the same package
+- // OR the invocationType is a subclass of the declaringClass
+- // AND the receiverType is the invocationType or its subclass
+- // OR the method is a static method accessed directly through a type
+- // OR previous assertions are true for one of the enclosing type
+- if (invocationType == declaringClass) return true;
+- if (invocationType.fPackage == declaringClass.fPackage) return true;
+-
+- ReferenceBinding currentType = invocationType;
+- TypeBinding receiverErasure = receiverType.erasure();
+- ReferenceBinding declaringErasure = (ReferenceBinding) declaringClass.erasure();
+- int depth = 0;
+- do {
+- if (currentType.findSuperTypeOriginatingFrom(declaringErasure) != null) {
+- if (invocationSite.isSuperAccess())
+- return true;
+- // receiverType can be an array binding in one case... see if you can change it
+- if (receiverType instanceof ArrayBinding)
+- return false;
+- if (isStatic()) {
+- if (depth > 0) invocationSite.setDepth(depth);
+- return true; // see 1FMEPDL - return invocationSite.isTypeAccess();
+- }
+- if (currentType == receiverErasure || receiverErasure.findSuperTypeOriginatingFrom(currentType) != null) {
+- if (depth > 0) invocationSite.setDepth(depth);
+- return true;
+- }
+- }
+- depth++;
+- currentType = currentType.enclosingType();
+- } while (currentType != null);
+- return false;
+- }
+-
+- if (isPrivate()) {
+- // answer true if the receiverType is the declaringClass
+- // AND the invocationType and the declaringClass have a common enclosingType
+- receiverCheck: {
+- if (receiverType != declaringClass) {
+- // special tolerance for type variable direct bounds
+- if (receiverType.isTypeVariable() && ((TypeVariableBinding) receiverType).isErasureBoundTo(declaringClass.erasure()))
+- break receiverCheck;
+- return false;
+- }
+- }
++ if (invocationType == null) // static import call
++ return !isPrivate() && scope.getCurrentPackage() == this.declaringClass.fPackage;
+
+- if (invocationType != declaringClass) {
+- ReferenceBinding outerInvocationType = invocationType;
+- ReferenceBinding temp = outerInvocationType.enclosingType();
+- while (temp != null) {
+- outerInvocationType = temp;
+- temp = temp.enclosingType();
+- }
+-
+- ReferenceBinding outerDeclaringClass = (ReferenceBinding)declaringClass.erasure();
+- temp = outerDeclaringClass.enclosingType();
+- while (temp != null) {
+- outerDeclaringClass = temp;
+- temp = temp.enclosingType();
+- }
+- if (outerInvocationType != outerDeclaringClass) return false;
+- }
+- return true;
+- }
+-
+- // isDefault()
+- PackageBinding declaringPackage = declaringClass.fPackage;
+- if (invocationType.fPackage != declaringPackage) return false;
+-
+- // receiverType can be an array binding in one case... see if you can change it
+- if (receiverType instanceof ArrayBinding)
+- return false;
+- ReferenceBinding currentType = (ReferenceBinding) receiverType;
+- do {
+- if (declaringClass == currentType) return true;
+- PackageBinding currentPackage = currentType.fPackage;
+- // package could be null for wildcards/intersection types, ignore and recurse in superclass
+- if (currentPackage != null && currentPackage != declaringPackage) return false;
+- } while ((currentType = currentType.superclass()) != null);
+- return false;
++ if (isProtected()) {
++ // answer true if the invocationType is the declaringClass or they are in the same package
++ // OR the invocationType is a subclass of the declaringClass
++ // AND the receiverType is the invocationType or its subclass
++ // OR the method is a static method accessed directly through a type
++ // OR previous assertions are true for one of the enclosing type
++ if (invocationType == this.declaringClass) return true;
++ if (invocationType.fPackage == this.declaringClass.fPackage) return true;
++
++ ReferenceBinding currentType = invocationType;
++ TypeBinding receiverErasure = receiverType.erasure();
++ ReferenceBinding declaringErasure = (ReferenceBinding) this.declaringClass.erasure();
++ int depth = 0;
++ do {
++ if (currentType.findSuperTypeOriginatingFrom(declaringErasure) != null) {
++ if (invocationSite.isSuperAccess())
++ return true;
++ // receiverType can be an array binding in one case... see if you can change it
++ if (receiverType instanceof ArrayBinding)
++ return false;
++ if (isStatic()) {
++ if (depth > 0) invocationSite.setDepth(depth);
++ return true; // see 1FMEPDL - return invocationSite.isTypeAccess();
++ }
++ if (currentType == receiverErasure || receiverErasure.findSuperTypeOriginatingFrom(currentType) != null) {
++ if (depth > 0) invocationSite.setDepth(depth);
++ return true;
++ }
++ }
++ depth++;
++ currentType = currentType.enclosingType();
++ } while (currentType != null);
++ return false;
++ }
++
++ if (isPrivate()) {
++ // answer true if the receiverType is the declaringClass
++ // AND the invocationType and the declaringClass have a common enclosingType
++ receiverCheck: {
++ if (receiverType != this.declaringClass) {
++ // special tolerance for type variable direct bounds
++ if (receiverType.isTypeVariable() && ((TypeVariableBinding) receiverType).isErasureBoundTo(this.declaringClass.erasure()))
++ break receiverCheck;
++ return false;
++ }
++ }
++
++ if (invocationType != this.declaringClass) {
++ ReferenceBinding outerInvocationType = invocationType;
++ ReferenceBinding temp = outerInvocationType.enclosingType();
++ while (temp != null) {
++ outerInvocationType = temp;
++ temp = temp.enclosingType();
++ }
++
++ ReferenceBinding outerDeclaringClass = (ReferenceBinding)this.declaringClass.erasure();
++ temp = outerDeclaringClass.enclosingType();
++ while (temp != null) {
++ outerDeclaringClass = temp;
++ temp = temp.enclosingType();
++ }
++ if (outerInvocationType != outerDeclaringClass) return false;
++ }
++ return true;
++ }
++
++ // isDefault()
++ PackageBinding declaringPackage = this.declaringClass.fPackage;
++ if (invocationType.fPackage != declaringPackage) return false;
++
++ // receiverType can be an array binding in one case... see if you can change it
++ if (receiverType instanceof ArrayBinding)
++ return false;
++ TypeBinding originalDeclaringClass = this.declaringClass.original();
++ ReferenceBinding currentType = (ReferenceBinding) receiverType;
++ do {
++ if (originalDeclaringClass == currentType.original()) return true;
++ PackageBinding currentPackage = currentType.fPackage;
++ // package could be null for wildcards/intersection types, ignore and recurse in superclass
++ if (currentPackage != null && currentPackage != declaringPackage) return false;
++ } while ((currentType = currentType.superclass()) != null);
++ return false;
+ }
+
+ public List collectMissingTypes(List missingTypes) {
+- if ((this.tagBits & TagBits.HasMissingType) != 0) {
+- missingTypes = this.returnType.collectMissingTypes(missingTypes);
+- for (int i = 0, max = this.parameters.length; i < max; i++) {
+- missingTypes = this.parameters[i].collectMissingTypes(missingTypes);
+- }
+- for (int i = 0, max = this.thrownExceptions.length; i < max; i++) {
+- missingTypes = this.thrownExceptions[i].collectMissingTypes(missingTypes);
+- }
+- for (int i = 0, max = this.typeVariables.length; i < max; i++) {
+- TypeVariableBinding variable = this.typeVariables[i];
+- missingTypes = variable.superclass().collectMissingTypes(missingTypes);
+- ReferenceBinding[] interfaces = variable.superInterfaces();
+- for (int j = 0, length = interfaces.length; j < length; j++) {
+- missingTypes = interfaces[j].collectMissingTypes(missingTypes);
+- }
+- }
+- }
+- return missingTypes;
++ if ((this.tagBits & TagBits.HasMissingType) != 0) {
++ missingTypes = this.returnType.collectMissingTypes(missingTypes);
++ for (int i = 0, max = this.parameters.length; i < max; i++) {
++ missingTypes = this.parameters[i].collectMissingTypes(missingTypes);
++ }
++ for (int i = 0, max = this.thrownExceptions.length; i < max; i++) {
++ missingTypes = this.thrownExceptions[i].collectMissingTypes(missingTypes);
++ }
++ for (int i = 0, max = this.typeVariables.length; i < max; i++) {
++ TypeVariableBinding variable = this.typeVariables[i];
++ missingTypes = variable.superclass().collectMissingTypes(missingTypes);
++ ReferenceBinding[] interfaces = variable.superInterfaces();
++ for (int j = 0, length = interfaces.length; j < length; j++) {
++ missingTypes = interfaces[j].collectMissingTypes(missingTypes);
++ }
++ }
++ }
++ return missingTypes;
+ }
+
+ MethodBinding computeSubstitutedMethod(MethodBinding method, LookupEnvironment env) {
+- int length = this.typeVariables.length;
+- TypeVariableBinding[] vars = method.typeVariables;
+- if (length != vars.length)
+- return null;
+-
+- // must substitute to detect cases like:
+- // <T1 extends X<T1>> void dup() {}
+- // <T2 extends X<T2>> Object dup() {return null;}
+- ParameterizedGenericMethodBinding substitute =
+- env.createParameterizedGenericMethod(method, this.typeVariables);
+- for (int i = 0; i < length; i++)
+- if (!this.typeVariables[i].isInterchangeableWith(vars[i], substitute))
+- return null;
+- return substitute;
++ int length = this.typeVariables.length;
++ TypeVariableBinding[] vars = method.typeVariables;
++ if (length != vars.length)
++ return null;
++
++ // must substitute to detect cases like:
++ // <T1 extends X<T1>> void dup() {}
++ // <T2 extends X<T2>> Object dup() {return null;}
++ ParameterizedGenericMethodBinding substitute =
++ env.createParameterizedGenericMethod(method, this.typeVariables);
++ for (int i = 0; i < length; i++)
++ if (!this.typeVariables[i].isInterchangeableWith(vars[i], substitute))
++ return null;
++ return substitute;
+ }
+
+ /*
+@@ -340,63 +365,55 @@
+ * p.X { <T> void bar(X<T> t) } --> Lp/X;.bar<T:Ljava/lang/Object;>(LX<TT;>;)V
+ */
+ public char[] computeUniqueKey(boolean isLeaf) {
+- // declaring class
+- char[] declaringKey = this.declaringClass.computeUniqueKey(false/*not a leaf*/);
+- int declaringLength = declaringKey.length;
+-
+- // selector
+- int selectorLength = this.selector == TypeConstants.INIT ? 0 : this.selector.length;
+-
+- // generic signature
+- char[] sig = genericSignature();
+- boolean isGeneric = sig != null;
+- if (!isGeneric) sig = signature();
+- int signatureLength = sig.length;
+-
+- // thrown exceptions
+- int thrownExceptionsLength = this.thrownExceptions.length;
+- int thrownExceptionsSignatureLength = 0;
+- char[][] thrownExceptionsSignatures = null;
+- boolean addThrownExceptions = thrownExceptionsLength > 0 && (!isGeneric || CharOperation.lastIndexOf('^', sig) < 0);
+- if (addThrownExceptions) {
+- thrownExceptionsSignatures = new char[thrownExceptionsLength][];
+- for (int i = 0; i < thrownExceptionsLength; i++) {
+- if (this.thrownExceptions[i] != null) {
+- thrownExceptionsSignatures[i] = this.thrownExceptions[i].signature();
+- thrownExceptionsSignatureLength += thrownExceptionsSignatures[i].length + 1; // add one char for separator
+- }
+- }
+- }
+-
+- char[] uniqueKey = new char[declaringLength + 1 + selectorLength + signatureLength + thrownExceptionsSignatureLength];
+- int index = 0;
+- System.arraycopy(declaringKey, 0, uniqueKey, index, declaringLength);
+- index = declaringLength;
+- uniqueKey[index++] = '.';
+- System.arraycopy(this.selector, 0, uniqueKey, index, selectorLength);
+- index += selectorLength;
+- System.arraycopy(sig, 0, uniqueKey, index, signatureLength);
+- if (thrownExceptionsSignatureLength > 0) {
+- index += signatureLength;
+- for (int i = 0; i < thrownExceptionsLength; i++) {
+- char[] thrownExceptionSignature = thrownExceptionsSignatures[i];
+- if (thrownExceptionSignature != null) {
+- uniqueKey[index++] = '|';
+- int length = thrownExceptionSignature.length;
+- System.arraycopy(thrownExceptionSignature, 0, uniqueKey, index, length);
+- index += length;
+- }
+- }
+- }
+- return uniqueKey;
+-}
+-
+-/*
+- * Answer the declaring class to use in the constant pool
+- * may not be a reference binding (see subtypes)
+- */
+-public TypeBinding constantPoolDeclaringClass() {
+- return this.declaringClass;
++ // declaring class
++ char[] declaringKey = this.declaringClass.computeUniqueKey(false/*not a leaf*/);
++ int declaringLength = declaringKey.length;
++
++ // selector
++ int selectorLength = this.selector == TypeConstants.INIT ? 0 : this.selector.length;
++
++ // generic signature
++ char[] sig = genericSignature();
++ boolean isGeneric = sig != null;
++ if (!isGeneric) sig = signature();
++ int signatureLength = sig.length;
++
++ // thrown exceptions
++ int thrownExceptionsLength = this.thrownExceptions.length;
++ int thrownExceptionsSignatureLength = 0;
++ char[][] thrownExceptionsSignatures = null;
++ boolean addThrownExceptions = thrownExceptionsLength > 0 && (!isGeneric || CharOperation.lastIndexOf('^', sig) < 0);
++ if (addThrownExceptions) {
++ thrownExceptionsSignatures = new char[thrownExceptionsLength][];
++ for (int i = 0; i < thrownExceptionsLength; i++) {
++ if (this.thrownExceptions[i] != null) {
++ thrownExceptionsSignatures[i] = this.thrownExceptions[i].signature();
++ thrownExceptionsSignatureLength += thrownExceptionsSignatures[i].length + 1; // add one char for separator
++ }
++ }
++ }
++
++ char[] uniqueKey = new char[declaringLength + 1 + selectorLength + signatureLength + thrownExceptionsSignatureLength];
++ int index = 0;
++ System.arraycopy(declaringKey, 0, uniqueKey, index, declaringLength);
++ index = declaringLength;
++ uniqueKey[index++] = '.';
++ System.arraycopy(this.selector, 0, uniqueKey, index, selectorLength);
++ index += selectorLength;
++ System.arraycopy(sig, 0, uniqueKey, index, signatureLength);
++ if (thrownExceptionsSignatureLength > 0) {
++ index += signatureLength;
++ for (int i = 0; i < thrownExceptionsLength; i++) {
++ char[] thrownExceptionSignature = thrownExceptionsSignatures[i];
++ if (thrownExceptionSignature != null) {
++ uniqueKey[index++] = '|';
++ int length = thrownExceptionSignature.length;
++ System.arraycopy(thrownExceptionSignature, 0, uniqueKey, index, length);
++ index += length;
++ }
++ }
++ }
++ return uniqueKey;
+ }
+
+ /* Answer the receiver's constant pool name.
+@@ -406,61 +423,78 @@
+ * or the source name of the method
+ */
+ public final char[] constantPoolName() {
+- return selector;
++ return this.selector;
++}
++
++public MethodBinding findOriginalInheritedMethod(MethodBinding inheritedMethod) {
++ MethodBinding inheritedOriginal = inheritedMethod.original();
++ TypeBinding superType = this.declaringClass.findSuperTypeOriginatingFrom(inheritedOriginal.declaringClass);
++ if (superType == null || !(superType instanceof ReferenceBinding)) return null;
++
++ if (inheritedOriginal.declaringClass != superType) {
++ // must find inherited method with the same substituted variables
++ MethodBinding[] superMethods = ((ReferenceBinding) superType).getMethods(inheritedOriginal.selector, inheritedOriginal.parameters.length);
++ for (int m = 0, l = superMethods.length; m < l; m++)
++ if (superMethods[m].original() == inheritedOriginal)
++ return superMethods[m];
++ }
++ return inheritedOriginal;
+ }
+
+ /**
++ * <pre>
+ *<typeParam1 ... typeParamM>(param1 ... paramN)returnType thrownException1 ... thrownExceptionP
+ * T foo(T t) throws X<T> ---> (TT;)TT;LX<TT;>;
+ * void bar(X<T> t) --> (LX<TT;>;)V
+ * <T> void bar(X<T> t) --> <T:Ljava.lang.Object;>(LX<TT;>;)V
++ * </pre>
+ */
+ public char[] genericSignature() {
+- if ((this.modifiers & ExtraCompilerModifiers.AccGenericSignature) == 0) return null;
+- StringBuffer sig = new StringBuffer(10);
+- if (this.typeVariables != Binding.NO_TYPE_VARIABLES) {
+- sig.append('<');
+- for (int i = 0, length = this.typeVariables.length; i < length; i++) {
+- sig.append(this.typeVariables[i].genericSignature());
+- }
+- sig.append('>');
+- }
+- sig.append('(');
+- for (int i = 0, length = this.parameters.length; i < length; i++) {
+- sig.append(this.parameters[i].genericTypeSignature());
+- }
+- sig.append(')');
+- if (this.returnType != null)
+- sig.append(this.returnType.genericTypeSignature());
+-
+- // only append thrown exceptions if any is generic/parameterized
+- boolean needExceptionSignatures = false;
+- int length = this.thrownExceptions.length;
+- for (int i = 0; i < length; i++) {
+- if((this.thrownExceptions[i].modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0) {
+- needExceptionSignatures = true;
+- break;
+- }
+- }
+- if (needExceptionSignatures) {
+- for (int i = 0; i < length; i++) {
+- sig.append('^');
+- sig.append(this.thrownExceptions[i].genericTypeSignature());
+- }
+- }
+- int sigLength = sig.length();
+- char[] genericSignature = new char[sigLength];
+- sig.getChars(0, sigLength, genericSignature, 0);
+- return genericSignature;
++ if ((this.modifiers & ExtraCompilerModifiers.AccGenericSignature) == 0) return null;
++ StringBuffer sig = new StringBuffer(10);
++ if (this.typeVariables != Binding.NO_TYPE_VARIABLES) {
++ sig.append('<');
++ for (int i = 0, length = this.typeVariables.length; i < length; i++) {
++ sig.append(this.typeVariables[i].genericSignature());
++ }
++ sig.append('>');
++ }
++ sig.append('(');
++ for (int i = 0, length = this.parameters.length; i < length; i++) {
++ sig.append(this.parameters[i].genericTypeSignature());
++ }
++ sig.append(')');
++ if (this.returnType != null)
++ sig.append(this.returnType.genericTypeSignature());
++
++ // only append thrown exceptions if any is generic/parameterized
++ boolean needExceptionSignatures = false;
++ int length = this.thrownExceptions.length;
++ for (int i = 0; i < length; i++) {
++ if((this.thrownExceptions[i].modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0) {
++ needExceptionSignatures = true;
++ break;
++ }
++ }
++ if (needExceptionSignatures) {
++ for (int i = 0; i < length; i++) {
++ sig.append('^');
++ sig.append(this.thrownExceptions[i].genericTypeSignature());
++ }
++ }
++ int sigLength = sig.length();
++ char[] genericSignature = new char[sigLength];
++ sig.getChars(0, sigLength, genericSignature, 0);
++ return genericSignature;
+ }
+
+ public final int getAccessFlags() {
+- return modifiers & ExtraCompilerModifiers.AccJustFlag;
++ return this.modifiers & ExtraCompilerModifiers.AccJustFlag;
+ }
+
+ public AnnotationBinding[] getAnnotations() {
+- MethodBinding originalMethod = this.original();
+- return originalMethod.declaringClass.retrieveAnnotations(originalMethod);
++ MethodBinding originalMethod = original();
++ return originalMethod.declaringClass.retrieveAnnotations(originalMethod);
+ }
+
+ /**
+@@ -469,142 +503,226 @@
+ * @see org.eclipse.jdt.internal.compiler.lookup.Binding#getAnnotationTagBits()
+ */
+ public long getAnnotationTagBits() {
+- MethodBinding originalMethod = this.original();
+- if ((originalMethod.tagBits & TagBits.AnnotationResolved) == 0 && originalMethod.declaringClass instanceof SourceTypeBinding) {
+- ClassScope scope = ((SourceTypeBinding) originalMethod.declaringClass).scope;
+- if (scope != null) {
+- TypeDeclaration typeDecl = scope.referenceContext;
+- AbstractMethodDeclaration methodDecl = typeDecl.declarationOf(originalMethod);
+- if (methodDecl != null)
+- ASTNode.resolveAnnotations(methodDecl.scope, methodDecl.annotations, originalMethod);
+- }
+- }
+- return originalMethod.tagBits;
++ MethodBinding originalMethod = original();
++ if ((originalMethod.tagBits & TagBits.AnnotationResolved) == 0 && originalMethod.declaringClass instanceof SourceTypeBinding) {
++ ClassScope scope = ((SourceTypeBinding) originalMethod.declaringClass).scope;
++ if (scope != null) {
++ TypeDeclaration typeDecl = scope.referenceContext;
++ AbstractMethodDeclaration methodDecl = typeDecl.declarationOf(originalMethod);
++ if (methodDecl != null)
++ ASTNode.resolveAnnotations(methodDecl.scope, methodDecl.annotations, originalMethod);
++ }
++ }
++ return originalMethod.tagBits;
+ }
++
+ /**
+ * @return the default value for this annotation method or <code>null</code> if there is no default value
+ */
+ public Object getDefaultValue() {
+- MethodBinding originalMethod = this.original();
+- if ((originalMethod.tagBits & TagBits.DefaultValueResolved) == 0) {
+- //The method has not been resolved nor has its class been resolved.
+- //It can only be from a source type within compilation units to process.
+- if (originalMethod.declaringClass instanceof SourceTypeBinding) {
+- SourceTypeBinding sourceType = (SourceTypeBinding) originalMethod.declaringClass;
+- if (sourceType.scope != null) {
+- AbstractMethodDeclaration methodDeclaration = originalMethod.sourceMethod();
+- if (methodDeclaration != null && methodDeclaration.isAnnotationMethod()) {
+- methodDeclaration.resolve(sourceType.scope);
+- }
+- }
+- }
+- originalMethod.tagBits |= TagBits.DefaultValueResolved;
+- }
+- AnnotationHolder holder = originalMethod.declaringClass.retrieveAnnotationHolder(originalMethod, true);
+- return holder == null ? null : holder.getDefaultValue();
++ MethodBinding originalMethod = original();
++ if ((originalMethod.tagBits & TagBits.DefaultValueResolved) == 0) {
++ //The method has not been resolved nor has its class been resolved.
++ //It can only be from a source type within compilation units to process.
++ if (originalMethod.declaringClass instanceof SourceTypeBinding) {
++ SourceTypeBinding sourceType = (SourceTypeBinding) originalMethod.declaringClass;
++ if (sourceType.scope != null) {
++ AbstractMethodDeclaration methodDeclaration = originalMethod.sourceMethod();
++ if (methodDeclaration != null && methodDeclaration.isAnnotationMethod()) {
++ methodDeclaration.resolve(sourceType.scope);
++ }
++ }
++ }
++ originalMethod.tagBits |= TagBits.DefaultValueResolved;
++ }
++ AnnotationHolder holder = originalMethod.declaringClass.retrieveAnnotationHolder(originalMethod, true);
++ return holder == null ? null : holder.getDefaultValue();
++}
++
++/**
++ * Return the highest method/constructor in supertype hierarchy with same selector and arguments
++ */
++public MethodBinding getHighestOverridenMethod(LookupEnvironment environment) {
++ MethodBinding bestMethod = this;
++ ReferenceBinding currentType = this.declaringClass;
++ if (this.isConstructor()) {
++ // walk superclasses - only
++ do {
++ MethodBinding superMethod = currentType.getExactConstructor(this.parameters);
++ if (superMethod != null) {
++ bestMethod = superMethod;
++ }
++ } while ((currentType = currentType.superclass()) != null);
++ return bestMethod;
++ }
++ MethodVerifier verifier = environment.methodVerifier();
++ // walk superclasses
++ ReferenceBinding[] interfacesToVisit = null;
++ int nextPosition = 0;
++ do {
++ MethodBinding[] superMethods = currentType.getMethods(this.selector);
++ for (int i = 0, length = superMethods.length; i < length; i++) {
++ if (verifier.doesMethodOverride(this, superMethods[i])) {
++ bestMethod = superMethods[i];
++ break;
++ }
++ }
++ ReferenceBinding[] itsInterfaces = currentType.superInterfaces();
++ if (itsInterfaces != null && itsInterfaces != Binding.NO_SUPERINTERFACES) {
++ if (interfacesToVisit == null) {
++ interfacesToVisit = itsInterfaces;
++ nextPosition = interfacesToVisit.length;
++ } else {
++ int itsLength = itsInterfaces.length;
++ if (nextPosition + itsLength >= interfacesToVisit.length)
++ System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition);
++ nextInterface : for (int a = 0; a < itsLength; a++) {
++ ReferenceBinding next = itsInterfaces[a];
++ for (int b = 0; b < nextPosition; b++)
++ if (next == interfacesToVisit[b]) continue nextInterface;
++ interfacesToVisit[nextPosition++] = next;
++ }
++ }
++ }
++ } while ((currentType = currentType.superclass()) != null);
++ if (bestMethod.declaringClass.id == TypeIds.T_JavaLangObject) {
++ return bestMethod;
++ }
++ // walk superinterfaces
++ for (int i = 0; i < nextPosition; i++) {
++ currentType = interfacesToVisit[i];
++ MethodBinding[] superMethods = currentType.getMethods(this.selector);
++ for (int j = 0, length = superMethods.length; j < length; j++) {
++ MethodBinding superMethod = superMethods[j];
++ if (verifier.doesMethodOverride(this, superMethod)) {
++ TypeBinding bestReturnType = bestMethod.returnType;
++ if (bestReturnType == superMethod.returnType
++ || bestMethod.returnType.findSuperTypeOriginatingFrom(superMethod.returnType) != null) {
++ bestMethod = superMethod;
++ }
++ break;
++ }
++ }
++ ReferenceBinding[] itsInterfaces = currentType.superInterfaces();
++ if (itsInterfaces != null && itsInterfaces != Binding.NO_SUPERINTERFACES) {
++ int itsLength = itsInterfaces.length;
++ if (nextPosition + itsLength >= interfacesToVisit.length)
++ System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition);
++ nextInterface : for (int a = 0; a < itsLength; a++) {
++ ReferenceBinding next = itsInterfaces[a];
++ for (int b = 0; b < nextPosition; b++)
++ if (next == interfacesToVisit[b]) continue nextInterface;
++ interfacesToVisit[nextPosition++] = next;
++ }
++ }
++ }
++ return bestMethod;
+ }
+
+ /**
+ * @return the annotations for each of the method parameters or <code>null></code>
+- * if there's no parameter or no annotation at all.
++ * if there's no parameter or no annotation at all.
+ */
+ public AnnotationBinding[][] getParameterAnnotations() {
+- int length = this.parameters.length;
+- if (this.parameters == null || length == 0) {
+- return null;
+- }
+- MethodBinding originalMethod = this.original();
+- AnnotationHolder holder = originalMethod.declaringClass.retrieveAnnotationHolder(originalMethod, true);
+- AnnotationBinding[][] allParameterAnnotations = holder == null ? null : holder.getParameterAnnotations();
+- if (allParameterAnnotations == null && (this.tagBits & TagBits.HasParameterAnnotations) != 0) {
+- allParameterAnnotations = new AnnotationBinding[length][];
+- // forward reference to method, where param annotations have not yet been associated to method
+- if (this.declaringClass instanceof SourceTypeBinding) {
+- SourceTypeBinding sourceType = (SourceTypeBinding) this.declaringClass;
+- if (sourceType.scope != null) {
+- AbstractMethodDeclaration methodDecl = sourceType.scope.referenceType().declarationOf(this);
+- for (int i = 0; i < length; i++) {
+- Argument argument = methodDecl.arguments[i];
+- if (argument.annotations != null) {
+- ASTNode.resolveAnnotations(methodDecl.scope, argument.annotations, argument.binding);
+- allParameterAnnotations[i] = argument.binding.getAnnotations();
+- } else {
+- allParameterAnnotations[i] = Binding.NO_ANNOTATIONS;
+- }
+- }
+- } else {
+- for (int i = 0; i < length; i++) {
+- allParameterAnnotations[i] = Binding.NO_ANNOTATIONS;
+- }
+- }
+- } else {
+- for (int i = 0; i < length; i++) {
+- allParameterAnnotations[i] = Binding.NO_ANNOTATIONS;
+- }
+- }
+- this.setParameterAnnotations(allParameterAnnotations);
+- }
+- return allParameterAnnotations;
++ int length;
++ if ((length = this.parameters.length) == 0) {
++ return null;
++ }
++ MethodBinding originalMethod = original();
++ AnnotationHolder holder = originalMethod.declaringClass.retrieveAnnotationHolder(originalMethod, true);
++ AnnotationBinding[][] allParameterAnnotations = holder == null ? null : holder.getParameterAnnotations();
++ if (allParameterAnnotations == null && (this.tagBits & TagBits.HasParameterAnnotations) != 0) {
++ allParameterAnnotations = new AnnotationBinding[length][];
++ // forward reference to method, where param annotations have not yet been associated to method
++ if (this.declaringClass instanceof SourceTypeBinding) {
++ SourceTypeBinding sourceType = (SourceTypeBinding) this.declaringClass;
++ if (sourceType.scope != null) {
++ AbstractMethodDeclaration methodDecl = sourceType.scope.referenceType().declarationOf(this);
++ for (int i = 0; i < length; i++) {
++ Argument argument = methodDecl.arguments[i];
++ if (argument.annotations != null) {
++ ASTNode.resolveAnnotations(methodDecl.scope, argument.annotations, argument.binding);
++ allParameterAnnotations[i] = argument.binding.getAnnotations();
++ } else {
++ allParameterAnnotations[i] = Binding.NO_ANNOTATIONS;
++ }
++ }
++ } else {
++ for (int i = 0; i < length; i++) {
++ allParameterAnnotations[i] = Binding.NO_ANNOTATIONS;
++ }
++ }
++ } else {
++ for (int i = 0; i < length; i++) {
++ allParameterAnnotations[i] = Binding.NO_ANNOTATIONS;
++ }
++ }
++ setParameterAnnotations(allParameterAnnotations);
++ }
++ return allParameterAnnotations;
+ }
++
+ public TypeVariableBinding getTypeVariable(char[] variableName) {
+- for (int i = this.typeVariables.length; --i >= 0;)
+- if (CharOperation.equals(this.typeVariables[i].sourceName, variableName))
+- return this.typeVariables[i];
+- return null;
++ for (int i = this.typeVariables.length; --i >= 0;)
++ if (CharOperation.equals(this.typeVariables[i].sourceName, variableName))
++ return this.typeVariables[i];
++ return null;
+ }
++
+ /**
+ * Returns true if method got substituted parameter types
+ * (see ParameterizedMethodBinding)
+ */
+ public boolean hasSubstitutedParameters() {
+- return false;
++ return false;
+ }
++
+ /* Answer true if the return type got substituted.
+ */
+ public boolean hasSubstitutedReturnType() {
+- return false;
++ return false;
+ }
+
+ /* Answer true if the receiver is an abstract method
+ */
+ public final boolean isAbstract() {
+- return (modifiers & ClassFileConstants.AccAbstract) != 0;
++ return (this.modifiers & ClassFileConstants.AccAbstract) != 0;
+ }
+
+ /* Answer true if the receiver is a bridge method
+ */
+ public final boolean isBridge() {
+- return (modifiers & ClassFileConstants.AccBridge) != 0;
++ return (this.modifiers & ClassFileConstants.AccBridge) != 0;
+ }
+
+ /* Answer true if the receiver is a constructor
+ */
+ public final boolean isConstructor() {
+- return selector == TypeConstants.INIT;
++ return this.selector == TypeConstants.INIT;
+ }
+
+ /* Answer true if the receiver has default visibility
+ */
+ public final boolean isDefault() {
+- return !isPublic() && !isProtected() && !isPrivate();
++ return !isPublic() && !isProtected() && !isPrivate();
+ }
+
+ /* Answer true if the receiver is a system generated default abstract method
+ */
+ public final boolean isDefaultAbstract() {
+- return (modifiers & ExtraCompilerModifiers.AccDefaultAbstract) != 0;
++ return (this.modifiers & ExtraCompilerModifiers.AccDefaultAbstract) != 0;
+ }
+
+ /* Answer true if the receiver is a deprecated method
+ */
+ public final boolean isDeprecated() {
+- return (modifiers & ClassFileConstants.AccDeprecated) != 0;
++ return (this.modifiers & ClassFileConstants.AccDeprecated) != 0;
+ }
+
+ /* Answer true if the receiver is final and cannot be overridden
+ */
+ public final boolean isFinal() {
+- return (modifiers & ClassFileConstants.AccFinal) != 0;
++ return (this.modifiers & ClassFileConstants.AccFinal) != 0;
+ }
+
+ /* Answer true if the receiver is implementing another method
+@@ -612,98 +730,107 @@
+ * Only set for source methods
+ */
+ public final boolean isImplementing() {
+- return (modifiers & ExtraCompilerModifiers.AccImplementing) != 0;
++ return (this.modifiers & ExtraCompilerModifiers.AccImplementing) != 0;
+ }
+
+ /*
+ * Answer true if the receiver is a "public static void main(String[])" method
+ */
+ public final boolean isMain() {
+- if (this.selector.length == 4 && CharOperation.equals(this.selector, TypeConstants.MAIN)
+- && ((this.modifiers & (ClassFileConstants.AccPublic | ClassFileConstants.AccStatic)) != 0)
+- && TypeBinding.VOID == this.returnType
+- && this.parameters.length == 1) {
+- TypeBinding paramType = this.parameters[0];
+- if (paramType.dimensions() == 1 && paramType.leafComponentType().id == TypeIds.T_JavaLangString) {
+- return true;
+- }
+- }
+- return false;
++ if (this.selector.length == 4 && CharOperation.equals(this.selector, TypeConstants.MAIN)
++ && ((this.modifiers & (ClassFileConstants.AccPublic | ClassFileConstants.AccStatic)) != 0)
++ && TypeBinding.VOID == this.returnType
++ && this.parameters.length == 1) {
++ TypeBinding paramType = this.parameters[0];
++ if (paramType.dimensions() == 1 && paramType.leafComponentType().id == TypeIds.T_JavaLangString) {
++ return true;
++ }
++ }
++ return false;
+ }
+
+ /* Answer true if the receiver is a native method
+ */
+ public final boolean isNative() {
+- return (modifiers & ClassFileConstants.AccNative) != 0;
++ return (this.modifiers & ClassFileConstants.AccNative) != 0;
+ }
+
+ /* Answer true if the receiver is overriding another method
+ * Only set for source methods
+ */
+ public final boolean isOverriding() {
+- return (modifiers & ExtraCompilerModifiers.AccOverriding) != 0;
++ return (this.modifiers & ExtraCompilerModifiers.AccOverriding) != 0;
+ }
+ /* Answer true if the receiver has private visibility
+ */
+ public final boolean isPrivate() {
+- return (modifiers & ClassFileConstants.AccPrivate) != 0;
++ return (this.modifiers & ClassFileConstants.AccPrivate) != 0;
+ }
++
++/* Answer true if the receiver has private visibility or if any of its enclosing types do.
++*/
++public final boolean isOrEnclosedByPrivateType() {
++ if ((this.modifiers & ClassFileConstants.AccPrivate) != 0)
++ return true;
++ return this.declaringClass != null && this.declaringClass.isOrEnclosedByPrivateType();
++}
++
+ /* Answer true if the receiver has protected visibility
+ */
+ public final boolean isProtected() {
+- return (modifiers & ClassFileConstants.AccProtected) != 0;
++ return (this.modifiers & ClassFileConstants.AccProtected) != 0;
+ }
+
+ /* Answer true if the receiver has public visibility
+ */
+ public final boolean isPublic() {
+- return (modifiers & ClassFileConstants.AccPublic) != 0;
++ return (this.modifiers & ClassFileConstants.AccPublic) != 0;
+ }
+
+ /* Answer true if the receiver is a static method
+ */
+ public final boolean isStatic() {
+- return (modifiers & ClassFileConstants.AccStatic) != 0;
++ return (this.modifiers & ClassFileConstants.AccStatic) != 0;
+ }
+
+ /* Answer true if all float operations must adher to IEEE 754 float/double rules
+ */
+ public final boolean isStrictfp() {
+- return (modifiers & ClassFileConstants.AccStrictfp) != 0;
++ return (this.modifiers & ClassFileConstants.AccStrictfp) != 0;
+ }
+
+ /* Answer true if the receiver is a synchronized method
+ */
+ public final boolean isSynchronized() {
+- return (modifiers & ClassFileConstants.AccSynchronized) != 0;
++ return (this.modifiers & ClassFileConstants.AccSynchronized) != 0;
+ }
+
+ /* Answer true if the receiver has public visibility
+ */
+ public final boolean isSynthetic() {
+- return (modifiers & ClassFileConstants.AccSynthetic) != 0;
++ return (this.modifiers & ClassFileConstants.AccSynthetic) != 0;
+ }
+
+ /* Answer true if the receiver has private visibility and is used locally
+ */
+ public final boolean isUsed() {
+- return (modifiers & ExtraCompilerModifiers.AccLocallyUsed) != 0;
++ return (this.modifiers & ExtraCompilerModifiers.AccLocallyUsed) != 0;
+ }
+
+ /* Answer true if the receiver method has varargs
+ */
+ public final boolean isVarargs() {
+- return (modifiers & ClassFileConstants.AccVarargs) != 0;
++ return (this.modifiers & ClassFileConstants.AccVarargs) != 0;
+ }
+
+ /* Answer true if the receiver's declaring type is deprecated (or any of its enclosing types)
+ */
+ public final boolean isViewedAsDeprecated() {
+- return (modifiers & (ClassFileConstants.AccDeprecated | ExtraCompilerModifiers.AccDeprecatedImplicitly)) != 0;
++ return (this.modifiers & (ClassFileConstants.AccDeprecated | ExtraCompilerModifiers.AccDeprecatedImplicitly)) != 0;
+ }
+
+ public final int kind() {
+- return Binding.METHOD;
++ return Binding.METHOD;
+ }
+ /* Answer true if the receiver is visible to the invocationPackage.
+ */
+@@ -712,76 +839,76 @@
+ * Returns the original method (as opposed to parameterized instances)
+ */
+ public MethodBinding original() {
+- return this;
++ return this;
+ }
+
+ public char[] readableName() /* foo(int, Thread) */ {
+- StringBuffer buffer = new StringBuffer(parameters.length + 1 * 20);
+- if (isConstructor())
+- buffer.append(declaringClass.sourceName());
+- else
+- buffer.append(selector);
+- buffer.append('(');
+- if (parameters != Binding.NO_PARAMETERS) {
+- for (int i = 0, length = parameters.length; i < length; i++) {
+- if (i > 0)
+- buffer.append(", "); //$NON-NLS-1$
+- buffer.append(parameters[i].sourceName());
+- }
+- }
+- buffer.append(')');
+- return buffer.toString().toCharArray();
++ StringBuffer buffer = new StringBuffer(this.parameters.length + 1 * 20);
++ if (isConstructor())
++ buffer.append(this.declaringClass.sourceName());
++ else
++ buffer.append(this.selector);
++ buffer.append('(');
++ if (this.parameters != Binding.NO_PARAMETERS) {
++ for (int i = 0, length = this.parameters.length; i < length; i++) {
++ if (i > 0)
++ buffer.append(", "); //$NON-NLS-1$
++ buffer.append(this.parameters[i].sourceName());
++ }
++ }
++ buffer.append(')');
++ return buffer.toString().toCharArray();
+ }
+ public void setAnnotations(AnnotationBinding[] annotations) {
+- this.declaringClass.storeAnnotations(this, annotations);
++ this.declaringClass.storeAnnotations(this, annotations);
+ }
+-public void setAnnotations(AnnotationBinding[] annotations, AnnotationBinding[][] parameterAnnotations, Object defaultValue) {
+- this.declaringClass.storeAnnotationHolder(this, AnnotationHolder.storeAnnotations(annotations, parameterAnnotations, defaultValue));
++public void setAnnotations(AnnotationBinding[] annotations, AnnotationBinding[][] parameterAnnotations, Object defaultValue, LookupEnvironment optionalEnv) {
++ this.declaringClass.storeAnnotationHolder(this, AnnotationHolder.storeAnnotations(annotations, parameterAnnotations, defaultValue, optionalEnv));
+ }
+ public void setDefaultValue(Object defaultValue) {
+- MethodBinding originalMethod = this.original();
+- originalMethod.tagBits |= TagBits.DefaultValueResolved;
++ MethodBinding originalMethod = original();
++ originalMethod.tagBits |= TagBits.DefaultValueResolved;
+
+- AnnotationHolder holder = this.declaringClass.retrieveAnnotationHolder(this, false);
+- if (holder == null)
+- setAnnotations(null, null, defaultValue);
+- else
+- setAnnotations(holder.getAnnotations(), holder.getParameterAnnotations(), defaultValue);
++ AnnotationHolder holder = this.declaringClass.retrieveAnnotationHolder(this, false);
++ if (holder == null)
++ setAnnotations(null, null, defaultValue, null);
++ else
++ setAnnotations(holder.getAnnotations(), holder.getParameterAnnotations(), defaultValue, null);
+ }
+ public void setParameterAnnotations(AnnotationBinding[][] parameterAnnotations) {
+- AnnotationHolder holder = this.declaringClass.retrieveAnnotationHolder(this, false);
+- if (holder == null)
+- setAnnotations(null, parameterAnnotations, null);
+- else
+- setAnnotations(holder.getAnnotations(), parameterAnnotations, holder.getDefaultValue());
++ AnnotationHolder holder = this.declaringClass.retrieveAnnotationHolder(this, false);
++ if (holder == null)
++ setAnnotations(null, parameterAnnotations, null, null);
++ else
++ setAnnotations(holder.getAnnotations(), parameterAnnotations, holder.getDefaultValue(), null);
+ }
+ protected final void setSelector(char[] selector) {
+- this.selector = selector;
+- this.signature = null;
++ this.selector = selector;
++ this.signature = null;
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.Binding#shortReadableName()
+ */
+ public char[] shortReadableName() {
+- StringBuffer buffer = new StringBuffer(parameters.length + 1 * 20);
+- if (isConstructor())
+- buffer.append(declaringClass.shortReadableName());
+- else
+- buffer.append(selector);
+- buffer.append('(');
+- if (parameters != Binding.NO_PARAMETERS) {
+- for (int i = 0, length = parameters.length; i < length; i++) {
+- if (i > 0)
+- buffer.append(", "); //$NON-NLS-1$
+- buffer.append(parameters[i].shortReadableName());
+- }
+- }
+- buffer.append(')');
+- int nameLength = buffer.length();
+- char[] shortReadableName = new char[nameLength];
+- buffer.getChars(0, nameLength, shortReadableName, 0);
+- return shortReadableName;
++ StringBuffer buffer = new StringBuffer(this.parameters.length + 1 * 20);
++ if (isConstructor())
++ buffer.append(this.declaringClass.shortReadableName());
++ else
++ buffer.append(this.selector);
++ buffer.append('(');
++ if (this.parameters != Binding.NO_PARAMETERS) {
++ for (int i = 0, length = this.parameters.length; i < length; i++) {
++ if (i > 0)
++ buffer.append(", "); //$NON-NLS-1$
++ buffer.append(this.parameters[i].shortReadableName());
++ }
++ }
++ buffer.append(')');
++ int nameLength = buffer.length();
++ char[] shortReadableName = new char[nameLength];
++ buffer.getChars(0, nameLength, shortReadableName, 0);
++ return shortReadableName;
+ }
+
+ /* Answer the receiver's signature.
+@@ -791,219 +918,219 @@
+ * type changes, the cached state is invalid.
+ */
+ public final char[] signature() /* (ILjava/lang/Thread;)Ljava/lang/Object; */ {
+- if (signature != null)
+- return signature;
++ if (this.signature != null)
++ return this.signature;
+
+- StringBuffer buffer = new StringBuffer(parameters.length + 1 * 20);
+- buffer.append('(');
+-
+- TypeBinding[] targetParameters = this.parameters;
+- boolean isConstructor = isConstructor();
+- if (isConstructor && declaringClass.isEnum()) { // insert String name,int ordinal
+- buffer.append(ConstantPool.JavaLangStringSignature);
+- buffer.append(TypeBinding.INT.signature());
+- }
+- boolean needSynthetics = isConstructor && declaringClass.isNestedType();
+- if (needSynthetics) {
+- // take into account the synthetic argument type signatures as well
+- ReferenceBinding[] syntheticArgumentTypes = declaringClass.syntheticEnclosingInstanceTypes();
+- if (syntheticArgumentTypes != null) {
+- for (int i = 0, count = syntheticArgumentTypes.length; i < count; i++) {
+- buffer.append(syntheticArgumentTypes[i].signature());
+- }
+- }
+-
+- if (this instanceof SyntheticMethodBinding) {
+- targetParameters = ((SyntheticMethodBinding)this).targetMethod.parameters;
+- }
+- }
++ StringBuffer buffer = new StringBuffer(this.parameters.length + 1 * 20);
++ buffer.append('(');
+
+- if (targetParameters != Binding.NO_PARAMETERS) {
+- for (int i = 0; i < targetParameters.length; i++) {
+- buffer.append(targetParameters[i].signature());
+- }
+- }
+- if (needSynthetics) {
+- SyntheticArgumentBinding[] syntheticOuterArguments = declaringClass.syntheticOuterLocalVariables();
+- int count = syntheticOuterArguments == null ? 0 : syntheticOuterArguments.length;
+- for (int i = 0; i < count; i++) {
+- buffer.append(syntheticOuterArguments[i].type.signature());
+- }
+- // move the extra padding arguments of the synthetic constructor invocation to the end
+- for (int i = targetParameters.length, extraLength = parameters.length; i < extraLength; i++) {
+- buffer.append(parameters[i].signature());
+- }
+- }
+- buffer.append(')');
+- if (this.returnType != null)
+- buffer.append(this.returnType.signature());
+- int nameLength = buffer.length();
+- signature = new char[nameLength];
+- buffer.getChars(0, nameLength, signature, 0);
+-
+- return signature;
++ TypeBinding[] targetParameters = this.parameters;
++ boolean isConstructor = isConstructor();
++ if (isConstructor && this.declaringClass.isEnum()) { // insert String name,int ordinal
++ buffer.append(ConstantPool.JavaLangStringSignature);
++ buffer.append(TypeBinding.INT.signature());
++ }
++ boolean needSynthetics = isConstructor && this.declaringClass.isNestedType();
++ if (needSynthetics) {
++ // take into account the synthetic argument type signatures as well
++ ReferenceBinding[] syntheticArgumentTypes = this.declaringClass.syntheticEnclosingInstanceTypes();
++ if (syntheticArgumentTypes != null) {
++ for (int i = 0, count = syntheticArgumentTypes.length; i < count; i++) {
++ buffer.append(syntheticArgumentTypes[i].signature());
++ }
++ }
++
++ if (this instanceof SyntheticMethodBinding) {
++ targetParameters = ((SyntheticMethodBinding)this).targetMethod.parameters;
++ }
++ }
++
++ if (targetParameters != Binding.NO_PARAMETERS) {
++ for (int i = 0; i < targetParameters.length; i++) {
++ buffer.append(targetParameters[i].signature());
++ }
++ }
++ if (needSynthetics) {
++ SyntheticArgumentBinding[] syntheticOuterArguments = this.declaringClass.syntheticOuterLocalVariables();
++ int count = syntheticOuterArguments == null ? 0 : syntheticOuterArguments.length;
++ for (int i = 0; i < count; i++) {
++ buffer.append(syntheticOuterArguments[i].type.signature());
++ }
++ // move the extra padding arguments of the synthetic constructor invocation to the end
++ for (int i = targetParameters.length, extraLength = this.parameters.length; i < extraLength; i++) {
++ buffer.append(this.parameters[i].signature());
++ }
++ }
++ buffer.append(')');
++ if (this.returnType != null)
++ buffer.append(this.returnType.signature());
++ int nameLength = buffer.length();
++ this.signature = new char[nameLength];
++ buffer.getChars(0, nameLength, this.signature, 0);
++
++ return this.signature;
+ }
+ /*
+ * This method is used to record references to nested types inside the method signature.
+ * This is the one that must be used during code generation.
+- *
++ *
+ * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=171184
+ */
+ public final char[] signature(ClassFile classFile) {
+- if (signature != null) {
+- if ((this.tagBits & TagBits.ContainsNestedTypesInSignature) != 0) {
+- // we need to record inner classes references
+- boolean isConstructor = isConstructor();
+- TypeBinding[] targetParameters = this.parameters;
+- boolean needSynthetics = isConstructor && declaringClass.isNestedType();
+- if (needSynthetics) {
+- // take into account the synthetic argument type signatures as well
+- ReferenceBinding[] syntheticArgumentTypes = declaringClass.syntheticEnclosingInstanceTypes();
+- if (syntheticArgumentTypes != null) {
+- for (int i = 0, count = syntheticArgumentTypes.length; i < count; i++) {
+- ReferenceBinding syntheticArgumentType = syntheticArgumentTypes[i];
+- if (syntheticArgumentType.isNestedType()) {
+- classFile.recordInnerClasses(syntheticArgumentType);
+- }
+- }
+- }
+- if (this instanceof SyntheticMethodBinding) {
+- targetParameters = ((SyntheticMethodBinding)this).targetMethod.parameters;
+- }
+- }
+-
+- if (targetParameters != Binding.NO_PARAMETERS) {
+- for (int i = 0; i < targetParameters.length; i++) {
+- TypeBinding targetParameter = targetParameters[i];
+- TypeBinding leafTargetParameterType = targetParameter.leafComponentType();
+- if (leafTargetParameterType.isNestedType()) {
+- classFile.recordInnerClasses(leafTargetParameterType);
+- }
+- }
+- }
+- if (needSynthetics) {
+- // move the extra padding arguments of the synthetic constructor invocation to the end
+- for (int i = targetParameters.length, extraLength = parameters.length; i < extraLength; i++) {
+- TypeBinding parameter = parameters[i];
+- TypeBinding leafParameterType = parameter.leafComponentType();
+- if (leafParameterType.isNestedType()) {
+- classFile.recordInnerClasses(leafParameterType);
+- }
+- }
+- }
+- if (this.returnType != null) {
+- TypeBinding ret = this.returnType.leafComponentType();
+- if (ret.isNestedType()) {
+- classFile.recordInnerClasses(ret);
+- }
+- }
+- }
+- return signature;
+- }
+-
+- StringBuffer buffer = new StringBuffer(parameters.length + 1 * 20);
+- buffer.append('(');
+-
+- TypeBinding[] targetParameters = this.parameters;
+- boolean isConstructor = isConstructor();
+- if (isConstructor && declaringClass.isEnum()) { // insert String name,int ordinal
+- buffer.append(ConstantPool.JavaLangStringSignature);
+- buffer.append(TypeBinding.INT.signature());
+- }
+- boolean needSynthetics = isConstructor && declaringClass.isNestedType();
+- if (needSynthetics) {
+- // take into account the synthetic argument type signatures as well
+- ReferenceBinding[] syntheticArgumentTypes = declaringClass.syntheticEnclosingInstanceTypes();
+- if (syntheticArgumentTypes != null) {
+- for (int i = 0, count = syntheticArgumentTypes.length; i < count; i++) {
+- ReferenceBinding syntheticArgumentType = syntheticArgumentTypes[i];
+- if (syntheticArgumentType.isNestedType()) {
+- this.tagBits |= TagBits.ContainsNestedTypesInSignature;
+- classFile.recordInnerClasses(syntheticArgumentType);
+- }
+- buffer.append(syntheticArgumentType.signature());
+- }
+- }
+-
+- if (this instanceof SyntheticMethodBinding) {
+- targetParameters = ((SyntheticMethodBinding)this).targetMethod.parameters;
+- }
+- }
++ if (this.signature != null) {
++ if ((this.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
++ // we need to record inner classes references
++ boolean isConstructor = isConstructor();
++ TypeBinding[] targetParameters = this.parameters;
++ boolean needSynthetics = isConstructor && this.declaringClass.isNestedType();
++ if (needSynthetics) {
++ // take into account the synthetic argument type signatures as well
++ ReferenceBinding[] syntheticArgumentTypes = this.declaringClass.syntheticEnclosingInstanceTypes();
++ if (syntheticArgumentTypes != null) {
++ for (int i = 0, count = syntheticArgumentTypes.length; i < count; i++) {
++ ReferenceBinding syntheticArgumentType = syntheticArgumentTypes[i];
++ if ((syntheticArgumentType.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
++ Util.recordNestedType(classFile, syntheticArgumentType);
++ }
++ }
++ }
++ if (this instanceof SyntheticMethodBinding) {
++ targetParameters = ((SyntheticMethodBinding)this).targetMethod.parameters;
++ }
++ }
++
++ if (targetParameters != Binding.NO_PARAMETERS) {
++ for (int i = 0, max = targetParameters.length; i < max; i++) {
++ TypeBinding targetParameter = targetParameters[i];
++ TypeBinding leafTargetParameterType = targetParameter.leafComponentType();
++ if ((leafTargetParameterType.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
++ Util.recordNestedType(classFile, leafTargetParameterType);
++ }
++ }
++ }
++ if (needSynthetics) {
++ // move the extra padding arguments of the synthetic constructor invocation to the end
++ for (int i = targetParameters.length, extraLength = this.parameters.length; i < extraLength; i++) {
++ TypeBinding parameter = this.parameters[i];
++ TypeBinding leafParameterType = parameter.leafComponentType();
++ if ((leafParameterType.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
++ Util.recordNestedType(classFile, leafParameterType);
++ }
++ }
++ }
++ if (this.returnType != null) {
++ TypeBinding ret = this.returnType.leafComponentType();
++ if ((ret.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
++ Util.recordNestedType(classFile, ret);
++ }
++ }
++ }
++ return this.signature;
++ }
++
++ StringBuffer buffer = new StringBuffer(this.parameters.length + 1 * 20);
++ buffer.append('(');
++
++ TypeBinding[] targetParameters = this.parameters;
++ boolean isConstructor = isConstructor();
++ if (isConstructor && this.declaringClass.isEnum()) { // insert String name,int ordinal
++ buffer.append(ConstantPool.JavaLangStringSignature);
++ buffer.append(TypeBinding.INT.signature());
++ }
++ boolean needSynthetics = isConstructor && this.declaringClass.isNestedType();
++ if (needSynthetics) {
++ // take into account the synthetic argument type signatures as well
++ ReferenceBinding[] syntheticArgumentTypes = this.declaringClass.syntheticEnclosingInstanceTypes();
++ if (syntheticArgumentTypes != null) {
++ for (int i = 0, count = syntheticArgumentTypes.length; i < count; i++) {
++ ReferenceBinding syntheticArgumentType = syntheticArgumentTypes[i];
++ if ((syntheticArgumentType.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
++ this.tagBits |= TagBits.ContainsNestedTypeReferences;
++ Util.recordNestedType(classFile, syntheticArgumentType);
++ }
++ buffer.append(syntheticArgumentType.signature());
++ }
++ }
++
++ if (this instanceof SyntheticMethodBinding) {
++ targetParameters = ((SyntheticMethodBinding)this).targetMethod.parameters;
++ }
++ }
++
++ if (targetParameters != Binding.NO_PARAMETERS) {
++ for (int i = 0, max = targetParameters.length; i < max; i++) {
++ TypeBinding targetParameter = targetParameters[i];
++ TypeBinding leafTargetParameterType = targetParameter.leafComponentType();
++ if ((leafTargetParameterType.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
++ this.tagBits |= TagBits.ContainsNestedTypeReferences;
++ Util.recordNestedType(classFile, leafTargetParameterType);
++ }
++ buffer.append(targetParameter.signature());
++ }
++ }
++ if (needSynthetics) {
++ SyntheticArgumentBinding[] syntheticOuterArguments = this.declaringClass.syntheticOuterLocalVariables();
++ int count = syntheticOuterArguments == null ? 0 : syntheticOuterArguments.length;
++ for (int i = 0; i < count; i++) {
++ buffer.append(syntheticOuterArguments[i].type.signature());
++ }
++ // move the extra padding arguments of the synthetic constructor invocation to the end
++ for (int i = targetParameters.length, extraLength = this.parameters.length; i < extraLength; i++) {
++ TypeBinding parameter = this.parameters[i];
++ TypeBinding leafParameterType = parameter.leafComponentType();
++ if ((leafParameterType.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
++ this.tagBits |= TagBits.ContainsNestedTypeReferences;
++ Util.recordNestedType(classFile, leafParameterType);
++ }
++ buffer.append(parameter.signature());
++ }
++ }
++ buffer.append(')');
++ if (this.returnType != null) {
++ TypeBinding ret = this.returnType.leafComponentType();
++ if ((ret.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
++ this.tagBits |= TagBits.ContainsNestedTypeReferences;
++ Util.recordNestedType(classFile, ret);
++ }
++ buffer.append(this.returnType.signature());
++ }
++ int nameLength = buffer.length();
++ this.signature = new char[nameLength];
++ buffer.getChars(0, nameLength, this.signature, 0);
+
+- if (targetParameters != Binding.NO_PARAMETERS) {
+- for (int i = 0; i < targetParameters.length; i++) {
+- TypeBinding targetParameter = targetParameters[i];
+- TypeBinding leafTargetParameterType = targetParameter.leafComponentType();
+- if (leafTargetParameterType.isNestedType()) {
+- this.tagBits |= TagBits.ContainsNestedTypesInSignature;
+- classFile.recordInnerClasses(leafTargetParameterType);
+- }
+- buffer.append(targetParameter.signature());
+- }
+- }
+- if (needSynthetics) {
+- SyntheticArgumentBinding[] syntheticOuterArguments = declaringClass.syntheticOuterLocalVariables();
+- int count = syntheticOuterArguments == null ? 0 : syntheticOuterArguments.length;
+- for (int i = 0; i < count; i++) {
+- buffer.append(syntheticOuterArguments[i].type.signature());
+- }
+- // move the extra padding arguments of the synthetic constructor invocation to the end
+- for (int i = targetParameters.length, extraLength = parameters.length; i < extraLength; i++) {
+- TypeBinding parameter = parameters[i];
+- TypeBinding leafParameterType = parameter.leafComponentType();
+- if (leafParameterType.isNestedType()) {
+- this.tagBits |= TagBits.ContainsNestedTypesInSignature;
+- classFile.recordInnerClasses(leafParameterType);
+- }
+- buffer.append(parameter.signature());
+- }
+- }
+- buffer.append(')');
+- if (this.returnType != null) {
+- TypeBinding ret = this.returnType.leafComponentType();
+- if (ret.isNestedType()) {
+- this.tagBits |= TagBits.ContainsNestedTypesInSignature;
+- classFile.recordInnerClasses(ret);
+- }
+- buffer.append(this.returnType.signature());
+- }
+- int nameLength = buffer.length();
+- signature = new char[nameLength];
+- buffer.getChars(0, nameLength, signature, 0);
+-
+- return signature;
++ return this.signature;
+ }
+ public final int sourceEnd() {
+- AbstractMethodDeclaration method = sourceMethod();
+- if (method == null) {
+- if (this.declaringClass instanceof SourceTypeBinding)
+- return ((SourceTypeBinding) this.declaringClass).sourceEnd();
+- return 0;
+- }
+- return method.sourceEnd;
++ AbstractMethodDeclaration method = sourceMethod();
++ if (method == null) {
++ if (this.declaringClass instanceof SourceTypeBinding)
++ return ((SourceTypeBinding) this.declaringClass).sourceEnd();
++ return 0;
++ }
++ return method.sourceEnd;
+ }
+ public AbstractMethodDeclaration sourceMethod() {
+- SourceTypeBinding sourceType;
+- try {
+- sourceType = (SourceTypeBinding) declaringClass;
+- } catch (ClassCastException e) {
+- return null;
+- }
+-
+- AbstractMethodDeclaration[] methods = sourceType.scope.referenceContext.methods;
+- for (int i = methods.length; --i >= 0;)
+- if (this == methods[i].binding)
+- return methods[i];
+- return null;
++ SourceTypeBinding sourceType;
++ try {
++ sourceType = (SourceTypeBinding) this.declaringClass;
++ } catch (ClassCastException e) {
++ return null;
++ }
++
++ AbstractMethodDeclaration[] methods = sourceType.scope.referenceContext.methods;
++ for (int i = methods.length; --i >= 0;)
++ if (this == methods[i].binding)
++ return methods[i];
++ return null;
+ }
+ public final int sourceStart() {
+- AbstractMethodDeclaration method = sourceMethod();
+- if (method == null) {
+- if (this.declaringClass instanceof SourceTypeBinding)
+- return ((SourceTypeBinding) this.declaringClass).sourceStart();
+- return 0;
+- }
+- return method.sourceStart;
++ AbstractMethodDeclaration method = sourceMethod();
++ if (method == null) {
++ if (this.declaringClass instanceof SourceTypeBinding)
++ return ((SourceTypeBinding) this.declaringClass).sourceStart();
++ return 0;
++ }
++ return method.sourceStart;
+ }
+
+ /**
+@@ -1011,46 +1138,46 @@
+ * For generic method invocations, tiebreak needs to use generic method with erasure substitutes.
+ */
+ public MethodBinding tiebreakMethod() {
+- return this;
++ return this;
+ }
+ public String toString() {
+- StringBuffer output = new StringBuffer(10);
+- if ((this.modifiers & ExtraCompilerModifiers.AccUnresolved) != 0) {
+- output.append("[unresolved] "); //$NON-NLS-1$
+- }
+- ASTNode.printModifiers(this.modifiers, output);
+- output.append(returnType != null ? returnType.debugName() : "<no type>"); //$NON-NLS-1$
+- output.append(" "); //$NON-NLS-1$
+- output.append(selector != null ? new String(selector) : "<no selector>"); //$NON-NLS-1$
+- output.append("("); //$NON-NLS-1$
+- if (parameters != null) {
+- if (parameters != Binding.NO_PARAMETERS) {
+- for (int i = 0, length = parameters.length; i < length; i++) {
+- if (i > 0)
+- output.append(", "); //$NON-NLS-1$
+- output.append(parameters[i] != null ? parameters[i].debugName() : "<no argument type>"); //$NON-NLS-1$
+- }
+- }
+- } else {
+- output.append("<no argument types>"); //$NON-NLS-1$
+- }
+- output.append(") "); //$NON-NLS-1$
+-
+- if (thrownExceptions != null) {
+- if (thrownExceptions != Binding.NO_EXCEPTIONS) {
+- output.append("throws "); //$NON-NLS-1$
+- for (int i = 0, length = thrownExceptions.length; i < length; i++) {
+- if (i > 0)
+- output.append(", "); //$NON-NLS-1$
+- output.append((thrownExceptions[i] != null) ? thrownExceptions[i].debugName() : "<no exception type>"); //$NON-NLS-1$
+- }
+- }
+- } else {
+- output.append("<no exception types>"); //$NON-NLS-1$
+- }
+- return output.toString();
++ StringBuffer output = new StringBuffer(10);
++ if ((this.modifiers & ExtraCompilerModifiers.AccUnresolved) != 0) {
++ output.append("[unresolved] "); //$NON-NLS-1$
++ }
++ ASTNode.printModifiers(this.modifiers, output);
++ output.append(this.returnType != null ? this.returnType.debugName() : "<no type>"); //$NON-NLS-1$
++ output.append(" "); //$NON-NLS-1$
++ output.append(this.selector != null ? new String(this.selector) : "<no selector>"); //$NON-NLS-1$
++ output.append("("); //$NON-NLS-1$
++ if (this.parameters != null) {
++ if (this.parameters != Binding.NO_PARAMETERS) {
++ for (int i = 0, length = this.parameters.length; i < length; i++) {
++ if (i > 0)
++ output.append(", "); //$NON-NLS-1$
++ output.append(this.parameters[i] != null ? this.parameters[i].debugName() : "<no argument type>"); //$NON-NLS-1$
++ }
++ }
++ } else {
++ output.append("<no argument types>"); //$NON-NLS-1$
++ }
++ output.append(") "); //$NON-NLS-1$
++
++ if (this.thrownExceptions != null) {
++ if (this.thrownExceptions != Binding.NO_EXCEPTIONS) {
++ output.append("throws "); //$NON-NLS-1$
++ for (int i = 0, length = this.thrownExceptions.length; i < length; i++) {
++ if (i > 0)
++ output.append(", "); //$NON-NLS-1$
++ output.append((this.thrownExceptions[i] != null) ? this.thrownExceptions[i].debugName() : "<no exception type>"); //$NON-NLS-1$
++ }
++ }
++ } else {
++ output.append("<no exception types>"); //$NON-NLS-1$
++ }
++ return output.toString();
+ }
+ public TypeVariableBinding[] typeVariables() {
+- return this.typeVariables;
++ return this.typeVariables;
+ }
+ }
+Index: gwt-debian/dev/core/src/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
+===================================================================
+--- gwt-debian.orig/dev/core/src/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 2011-12-21 11:43:29.209247312 +0100
++++ gwt-debian/dev/core/src/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 2011-12-21 11:44:39.325245355 +0100
+@@ -1,5 +1,5 @@
+ /*******************************************************************************
+- * Copyright (c) 2000, 2008 IBM Corporation and others.
++ * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+@@ -10,7 +10,7 @@
+ *******************************************************************************/
+ package org.eclipse.jdt.internal.compiler.lookup;
+
+-import com.google.gwt.dev.util.collect.HashMap;
++import java.util.Iterator;
+
+ import org.eclipse.jdt.core.compiler.CharOperation;
+ import org.eclipse.jdt.internal.compiler.ast.ASTNode;
+@@ -27,626 +27,624 @@
+ import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable;
+ import org.eclipse.jdt.internal.compiler.util.Util;
+
+-import java.util.Hashtable;
+-import java.util.Iterator;
++import com.google.gwt.dev.util.collect.HashMap;
+
+ public class SourceTypeBinding extends ReferenceBinding {
+- public ReferenceBinding superclass;
+- public ReferenceBinding[] superInterfaces;
+- private FieldBinding[] fields;
+- private MethodBinding[] methods;
+- public ReferenceBinding[] memberTypes;
+- public TypeVariableBinding[] typeVariables;
+-
+- public ClassScope scope;
+-
+- // Synthetics are separated into 5 categories: methods, super methods, fields, class literals, changed declaring type bindings and bridge methods
+- // if a new category is added, also increment MAX_SYNTHETICS
+- private final static int METHOD_EMUL = 0;
+- private final static int FIELD_EMUL = 1;
+- private final static int CLASS_LITERAL_EMUL = 2;
+- private final static int RECEIVER_TYPE_EMUL = 3;
+-
+- private final static int MAX_SYNTHETICS = 4;
++ public ReferenceBinding superclass;
++ public ReferenceBinding[] superInterfaces;
++ private FieldBinding[] fields;
++ private MethodBinding[] methods;
++ public ReferenceBinding[] memberTypes;
++ public TypeVariableBinding[] typeVariables;
++
++ public ClassScope scope;
++
++ // Synthetics are separated into 4 categories: methods, super methods, fields, class literals and bridge methods
++ // if a new category is added, also increment MAX_SYNTHETICS
++ private final static int METHOD_EMUL = 0;
++ private final static int FIELD_EMUL = 1;
++ private final static int CLASS_LITERAL_EMUL = 2;
++
++ private final static int MAX_SYNTHETICS = 3;
+
+- HashMap[] synthetics;
+- char[] genericReferenceTypeSignature;
++ HashMap[] synthetics;
++ char[] genericReferenceTypeSignature;
+
+- private SimpleLookupTable storedAnnotations = null; // keys are this ReferenceBinding & its fields and methods, value is an AnnotationHolder
++ private SimpleLookupTable storedAnnotations = null; // keys are this ReferenceBinding & its fields and methods, value is an AnnotationHolder
+
+ public SourceTypeBinding(char[][] compoundName, PackageBinding fPackage, ClassScope scope) {
+- this.compoundName = compoundName;
+- this.fPackage = fPackage;
+- this.fileName = scope.referenceCompilationUnit().getFileName();
+- this.modifiers = scope.referenceContext.modifiers;
+- this.sourceName = scope.referenceContext.name;
+- this.scope = scope;
+-
+- // expect the fields & methods to be initialized correctly later
+- this.fields = Binding.UNINITIALIZED_FIELDS;
+- this.methods = Binding.UNINITIALIZED_METHODS;
++ this.compoundName = compoundName;
++ this.fPackage = fPackage;
++ this.fileName = scope.referenceCompilationUnit().getFileName();
++ this.modifiers = scope.referenceContext.modifiers;
++ this.sourceName = scope.referenceContext.name;
++ this.scope = scope;
++
++ // expect the fields & methods to be initialized correctly later
++ this.fields = Binding.UNINITIALIZED_FIELDS;
++ this.methods = Binding.UNINITIALIZED_METHODS;
+
+- computeId();
++ computeId();
+ }
+
+ private void addDefaultAbstractMethods() {
+- if ((this.tagBits & TagBits.KnowsDefaultAbstractMethods) != 0) return;
++ if ((this.tagBits & TagBits.KnowsDefaultAbstractMethods) != 0) return;
+
+- this.tagBits |= TagBits.KnowsDefaultAbstractMethods;
+- if (isClass() && isAbstract()) {
+- if (this.scope.compilerOptions().targetJDK >= ClassFileConstants.JDK1_2)
+- return; // no longer added for post 1.2 targets
+-
+- ReferenceBinding[] itsInterfaces = superInterfaces();
+- if (itsInterfaces != Binding.NO_SUPERINTERFACES) {
+- MethodBinding[] defaultAbstracts = null;
+- int defaultAbstractsCount = 0;
+- ReferenceBinding[] interfacesToVisit = itsInterfaces;
+- int nextPosition = interfacesToVisit.length;
+- for (int i = 0; i < nextPosition; i++) {
+- ReferenceBinding superType = interfacesToVisit[i];
+- if (superType.isValidBinding()) {
+- MethodBinding[] superMethods = superType.methods();
+- nextAbstractMethod: for (int m = superMethods.length; --m >= 0;) {
+- MethodBinding method = superMethods[m];
+- // explicitly implemented ?
+- if (implementsMethod(method))
+- continue nextAbstractMethod;
+- if (defaultAbstractsCount == 0) {
+- defaultAbstracts = new MethodBinding[5];
+- } else {
+- // already added as default abstract ?
+- for (int k = 0; k < defaultAbstractsCount; k++) {
+- MethodBinding alreadyAdded = defaultAbstracts[k];
+- if (CharOperation.equals(alreadyAdded.selector, method.selector) && alreadyAdded.areParametersEqual(method))
+- continue nextAbstractMethod;
+- }
+- }
+- MethodBinding defaultAbstract = new MethodBinding(
+- method.modifiers | ExtraCompilerModifiers.AccDefaultAbstract | ClassFileConstants.AccSynthetic,
+- method.selector,
+- method.returnType,
+- method.parameters,
+- method.thrownExceptions,
+- this);
+- if (defaultAbstractsCount == defaultAbstracts.length)
+- System.arraycopy(defaultAbstracts, 0, defaultAbstracts = new MethodBinding[2 * defaultAbstractsCount], 0, defaultAbstractsCount);
+- defaultAbstracts[defaultAbstractsCount++] = defaultAbstract;
+- }
+-
+- if ((itsInterfaces = superType.superInterfaces()) != Binding.NO_SUPERINTERFACES) {
+- int itsLength = itsInterfaces.length;
+- if (nextPosition + itsLength >= interfacesToVisit.length)
+- System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition);
+- nextInterface : for (int a = 0; a < itsLength; a++) {
+- ReferenceBinding next = itsInterfaces[a];
+- for (int b = 0; b < nextPosition; b++)
+- if (next == interfacesToVisit[b]) continue nextInterface;
+- interfacesToVisit[nextPosition++] = next;
+- }
+- }
+- }
+- }
+- if (defaultAbstractsCount > 0) {
+- int length = this.methods.length;
+- System.arraycopy(this.methods, 0, this.methods = new MethodBinding[length + defaultAbstractsCount], 0, length);
+- System.arraycopy(defaultAbstracts, 0, this.methods, length, defaultAbstractsCount);
+- // re-sort methods
+- length = length + defaultAbstractsCount;
+- if (length > 1)
+- ReferenceBinding.sortMethods(this.methods, 0, length);
+- // this.tagBits |= TagBits.AreMethodsSorted; -- already set in #methods()
+- }
+- }
+- }
++ this.tagBits |= TagBits.KnowsDefaultAbstractMethods;
++ if (isClass() && isAbstract()) {
++ if (this.scope.compilerOptions().targetJDK >= ClassFileConstants.JDK1_2)
++ return; // no longer added for post 1.2 targets
++
++ ReferenceBinding[] itsInterfaces = superInterfaces();
++ if (itsInterfaces != Binding.NO_SUPERINTERFACES) {
++ MethodBinding[] defaultAbstracts = null;
++ int defaultAbstractsCount = 0;
++ ReferenceBinding[] interfacesToVisit = itsInterfaces;
++ int nextPosition = interfacesToVisit.length;
++ for (int i = 0; i < nextPosition; i++) {
++ ReferenceBinding superType = interfacesToVisit[i];
++ if (superType.isValidBinding()) {
++ MethodBinding[] superMethods = superType.methods();
++ nextAbstractMethod: for (int m = superMethods.length; --m >= 0;) {
++ MethodBinding method = superMethods[m];
++ // explicitly implemented ?
++ if (implementsMethod(method))
++ continue nextAbstractMethod;
++ if (defaultAbstractsCount == 0) {
++ defaultAbstracts = new MethodBinding[5];
++ } else {
++ // already added as default abstract ?
++ for (int k = 0; k < defaultAbstractsCount; k++) {
++ MethodBinding alreadyAdded = defaultAbstracts[k];
++ if (CharOperation.equals(alreadyAdded.selector, method.selector) && alreadyAdded.areParametersEqual(method))
++ continue nextAbstractMethod;
++ }
++ }
++ MethodBinding defaultAbstract = new MethodBinding(
++ method.modifiers | ExtraCompilerModifiers.AccDefaultAbstract | ClassFileConstants.AccSynthetic,
++ method.selector,
++ method.returnType,
++ method.parameters,
++ method.thrownExceptions,
++ this);
++ if (defaultAbstractsCount == defaultAbstracts.length)
++ System.arraycopy(defaultAbstracts, 0, defaultAbstracts = new MethodBinding[2 * defaultAbstractsCount], 0, defaultAbstractsCount);
++ defaultAbstracts[defaultAbstractsCount++] = defaultAbstract;
++ }
++
++ if ((itsInterfaces = superType.superInterfaces()) != Binding.NO_SUPERINTERFACES) {
++ int itsLength = itsInterfaces.length;
++ if (nextPosition + itsLength >= interfacesToVisit.length)
++ System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition);
++ nextInterface : for (int a = 0; a < itsLength; a++) {
++ ReferenceBinding next = itsInterfaces[a];
++ for (int b = 0; b < nextPosition; b++)
++ if (next == interfacesToVisit[b]) continue nextInterface;
++ interfacesToVisit[nextPosition++] = next;
++ }
++ }
++ }
++ }
++ if (defaultAbstractsCount > 0) {
++ int length = this.methods.length;
++ System.arraycopy(this.methods, 0, this.methods = new MethodBinding[length + defaultAbstractsCount], 0, length);
++ System.arraycopy(defaultAbstracts, 0, this.methods, length, defaultAbstractsCount);
++ // re-sort methods
++ length = length + defaultAbstractsCount;
++ if (length > 1)
++ ReferenceBinding.sortMethods(this.methods, 0, length);
++ // this.tagBits |= TagBits.AreMethodsSorted; -- already set in #methods()
++ }
++ }
++ }
+ }
+ /* Add a new synthetic field for <actualOuterLocalVariable>.
+-* Answer the new field or the existing field if one already existed.
++* Answer the new field or the existing field if one already existed.
+ */
+ public FieldBinding addSyntheticFieldForInnerclass(LocalVariableBinding actualOuterLocalVariable) {
+- if (this.synthetics == null)
+- this.synthetics = new HashMap[MAX_SYNTHETICS];
+- if (this.synthetics[SourceTypeBinding.FIELD_EMUL] == null)
+- this.synthetics[SourceTypeBinding.FIELD_EMUL] = new HashMap();
+-
+- FieldBinding synthField = (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get(actualOuterLocalVariable);
+- if (synthField == null) {
+- synthField = new SyntheticFieldBinding(
+- CharOperation.concat(TypeConstants.SYNTHETIC_OUTER_LOCAL_PREFIX, actualOuterLocalVariable.name),
+- actualOuterLocalVariable.type,
+- ClassFileConstants.AccPrivate | ClassFileConstants.AccFinal | ClassFileConstants.AccSynthetic,
+- this,
+- Constant.NotAConstant,
+- this.synthetics[SourceTypeBinding.FIELD_EMUL].size());
+- this.synthetics[SourceTypeBinding.FIELD_EMUL].put(actualOuterLocalVariable, synthField);
+- }
+-
+- // ensure there is not already such a field defined by the user
+- boolean needRecheck;
+- int index = 1;
+- do {
+- needRecheck = false;
+- FieldBinding existingField;
+- if ((existingField = this.getField(synthField.name, true /*resolve*/)) != null) {
+- TypeDeclaration typeDecl = this.scope.referenceContext;
+- for (int i = 0, max = typeDecl.fields.length; i < max; i++) {
+- FieldDeclaration fieldDecl = typeDecl.fields[i];
+- if (fieldDecl.binding == existingField) {
+- synthField.name = CharOperation.concat(
+- TypeConstants.SYNTHETIC_OUTER_LOCAL_PREFIX,
+- actualOuterLocalVariable.name,
+- ("$" + String.valueOf(index++)).toCharArray()); //$NON-NLS-1$
+- needRecheck = true;
+- break;
+- }
+- }
+- }
+- } while (needRecheck);
+- return synthField;
++ if (this.synthetics == null)
++ this.synthetics = new HashMap[MAX_SYNTHETICS];
++ if (this.synthetics[SourceTypeBinding.FIELD_EMUL] == null)
++ this.synthetics[SourceTypeBinding.FIELD_EMUL] = new HashMap();
++
++ FieldBinding synthField = (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get(actualOuterLocalVariable);
++ if (synthField == null) {
++ synthField = new SyntheticFieldBinding(
++ CharOperation.concat(TypeConstants.SYNTHETIC_OUTER_LOCAL_PREFIX, actualOuterLocalVariable.name),
++ actualOuterLocalVariable.type,
++ ClassFileConstants.AccPrivate | ClassFileConstants.AccFinal | ClassFileConstants.AccSynthetic,
++ this,
++ Constant.NotAConstant,
++ this.synthetics[SourceTypeBinding.FIELD_EMUL].size());
++ this.synthetics[SourceTypeBinding.FIELD_EMUL].put(actualOuterLocalVariable, synthField);
++ }
++
++ // ensure there is not already such a field defined by the user
++ boolean needRecheck;
++ int index = 1;
++ do {
++ needRecheck = false;
++ FieldBinding existingField;
++ if ((existingField = getField(synthField.name, true /*resolve*/)) != null) {
++ TypeDeclaration typeDecl = this.scope.referenceContext;
++ for (int i = 0, max = typeDecl.fields.length; i < max; i++) {
++ FieldDeclaration fieldDecl = typeDecl.fields[i];
++ if (fieldDecl.binding == existingField) {
++ synthField.name = CharOperation.concat(
++ TypeConstants.SYNTHETIC_OUTER_LOCAL_PREFIX,
++ actualOuterLocalVariable.name,
++ ("$" + String.valueOf(index++)).toCharArray()); //$NON-NLS-1$
++ needRecheck = true;
++ break;
++ }
++ }
++ }
++ } while (needRecheck);
++ return synthField;
+ }
+ /* Add a new synthetic field for <enclosingType>.
+-* Answer the new field or the existing field if one already existed.
++* Answer the new field or the existing field if one already existed.
+ */
+ public FieldBinding addSyntheticFieldForInnerclass(ReferenceBinding enclosingType) {
+- if (this.synthetics == null)
+- this.synthetics = new HashMap[MAX_SYNTHETICS];
+- if (this.synthetics[SourceTypeBinding.FIELD_EMUL] == null)
++ if (this.synthetics == null)
++ this.synthetics = new HashMap[MAX_SYNTHETICS];
++ if (this.synthetics[SourceTypeBinding.FIELD_EMUL] == null)
+ this.synthetics[SourceTypeBinding.FIELD_EMUL] = new HashMap();
+
+- FieldBinding synthField = (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get(enclosingType);
+- if (synthField == null) {
+- synthField = new SyntheticFieldBinding(
+- CharOperation.concat(
+- TypeConstants.SYNTHETIC_ENCLOSING_INSTANCE_PREFIX,
+- String.valueOf(enclosingType.depth()).toCharArray()),
+- enclosingType,
+- ClassFileConstants.AccDefault | ClassFileConstants.AccFinal | ClassFileConstants.AccSynthetic,
+- this,
+- Constant.NotAConstant,
+- this.synthetics[SourceTypeBinding.FIELD_EMUL].size());
+- this.synthetics[SourceTypeBinding.FIELD_EMUL].put(enclosingType, synthField);
+- }
+- // ensure there is not already such a field defined by the user
+- boolean needRecheck;
+- do {
+- needRecheck = false;
+- FieldBinding existingField;
+- if ((existingField = this.getField(synthField.name, true /*resolve*/)) != null) {
+- TypeDeclaration typeDecl = this.scope.referenceContext;
+- for (int i = 0, max = typeDecl.fields.length; i < max; i++) {
+- FieldDeclaration fieldDecl = typeDecl.fields[i];
+- if (fieldDecl.binding == existingField) {
+- if (this.scope.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_5) {
+- synthField.name = CharOperation.concat(
+- synthField.name,
+- "$".toCharArray()); //$NON-NLS-1$
+- needRecheck = true;
+- } else {
+- this.scope.problemReporter().duplicateFieldInType(this, fieldDecl);
+- }
+- break;
+- }
+- }
+- }
+- } while (needRecheck);
+- return synthField;
++ FieldBinding synthField = (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get(enclosingType);
++ if (synthField == null) {
++ synthField = new SyntheticFieldBinding(
++ CharOperation.concat(
++ TypeConstants.SYNTHETIC_ENCLOSING_INSTANCE_PREFIX,
++ String.valueOf(enclosingType.depth()).toCharArray()),
++ enclosingType,
++ ClassFileConstants.AccDefault | ClassFileConstants.AccFinal | ClassFileConstants.AccSynthetic,
++ this,
++ Constant.NotAConstant,
++ this.synthetics[SourceTypeBinding.FIELD_EMUL].size());
++ this.synthetics[SourceTypeBinding.FIELD_EMUL].put(enclosingType, synthField);
++ }
++ // ensure there is not already such a field defined by the user
++ boolean needRecheck;
++ do {
++ needRecheck = false;
++ FieldBinding existingField;
++ if ((existingField = getField(synthField.name, true /*resolve*/)) != null) {
++ TypeDeclaration typeDecl = this.scope.referenceContext;
++ for (int i = 0, max = typeDecl.fields.length; i < max; i++) {
++ FieldDeclaration fieldDecl = typeDecl.fields[i];
++ if (fieldDecl.binding == existingField) {
++ if (this.scope.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_5) {
++ synthField.name = CharOperation.concat(
++ synthField.name,
++ "$".toCharArray()); //$NON-NLS-1$
++ needRecheck = true;
++ } else {
++ this.scope.problemReporter().duplicateFieldInType(this, fieldDecl);
++ }
++ break;
++ }
++ }
++ }
++ } while (needRecheck);
++ return synthField;
+ }
+ /* Add a new synthetic field for a class literal access.
+-* Answer the new field or the existing field if one already existed.
++* Answer the new field or the existing field if one already existed.
+ */
+ public FieldBinding addSyntheticFieldForClassLiteral(TypeBinding targetType, BlockScope blockScope) {
+- if (this.synthetics == null)
+- this.synthetics = new HashMap[MAX_SYNTHETICS];
+- if (this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL] == null)
++ if (this.synthetics == null)
++ this.synthetics = new HashMap[MAX_SYNTHETICS];
++ if (this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL] == null)
+ this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL] = new HashMap();
+
+- // use a different table than FIELDS, given there might be a collision between emulation of X.this$0 and X.class.
+- FieldBinding synthField = (FieldBinding) this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].get(targetType);
+- if (synthField == null) {
+- synthField = new SyntheticFieldBinding(
+- CharOperation.concat(
+- TypeConstants.SYNTHETIC_CLASS,
+- String.valueOf(this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].size()).toCharArray()),
+- blockScope.getJavaLangClass(),
+- ClassFileConstants.AccDefault | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic,
+- this,
+- Constant.NotAConstant,
+- this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].size());
+- this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].put(targetType, synthField);
+- }
+- // ensure there is not already such a field defined by the user
+- FieldBinding existingField;
+- if ((existingField = this.getField(synthField.name, true /*resolve*/)) != null) {
+- TypeDeclaration typeDecl = blockScope.referenceType();
+- for (int i = 0, max = typeDecl.fields.length; i < max; i++) {
+- FieldDeclaration fieldDecl = typeDecl.fields[i];
+- if (fieldDecl.binding == existingField) {
+- blockScope.problemReporter().duplicateFieldInType(this, fieldDecl);
+- break;
+- }
+- }
+- }
+- return synthField;
++ // use a different table than FIELDS, given there might be a collision between emulation of X.this$0 and X.class.
++ FieldBinding synthField = (FieldBinding) this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].get(targetType);
++ if (synthField == null) {
++ synthField = new SyntheticFieldBinding(
++ CharOperation.concat(
++ TypeConstants.SYNTHETIC_CLASS,
++ String.valueOf(this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].size()).toCharArray()),
++ blockScope.getJavaLangClass(),
++ ClassFileConstants.AccDefault | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic,
++ this,
++ Constant.NotAConstant,
++ this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].size());
++ this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].put(targetType, synthField);
++ }
++ // ensure there is not already such a field defined by the user
++ FieldBinding existingField;
++ if ((existingField = getField(synthField.name, true /*resolve*/)) != null) {
++ TypeDeclaration typeDecl = blockScope.referenceType();
++ for (int i = 0, max = typeDecl.fields.length; i < max; i++) {
++ FieldDeclaration fieldDecl = typeDecl.fields[i];
++ if (fieldDecl.binding == existingField) {
++ blockScope.problemReporter().duplicateFieldInType(this, fieldDecl);
++ break;
++ }
++ }
++ }
++ return synthField;
+ }
+ /* Add a new synthetic field for the emulation of the assert statement.
+-* Answer the new field or the existing field if one already existed.
++* Answer the new field or the existing field if one already existed.
+ */
+ public FieldBinding addSyntheticFieldForAssert(BlockScope blockScope) {
+- if (this.synthetics == null)
+- this.synthetics = new HashMap[MAX_SYNTHETICS];
+- if (this.synthetics[SourceTypeBinding.FIELD_EMUL] == null)
++ if (this.synthetics == null)
++ this.synthetics = new HashMap[MAX_SYNTHETICS];
++ if (this.synthetics[SourceTypeBinding.FIELD_EMUL] == null)
+ this.synthetics[SourceTypeBinding.FIELD_EMUL] = new HashMap();
+
+- FieldBinding synthField = (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get("assertionEmulation"); //$NON-NLS-1$
+- if (synthField == null) {
+- synthField = new SyntheticFieldBinding(
+- TypeConstants.SYNTHETIC_ASSERT_DISABLED,
+- TypeBinding.BOOLEAN,
+- ClassFileConstants.AccDefault | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic | ClassFileConstants.AccFinal,
+- this,
+- Constant.NotAConstant,
+- this.synthetics[SourceTypeBinding.FIELD_EMUL].size());
+- this.synthetics[SourceTypeBinding.FIELD_EMUL].put("assertionEmulation", synthField); //$NON-NLS-1$
+- }
+- // ensure there is not already such a field defined by the user
+- // ensure there is not already such a field defined by the user
+- boolean needRecheck;
+- int index = 0;
+- do {
+- needRecheck = false;
+- FieldBinding existingField;
+- if ((existingField = this.getField(synthField.name, true /*resolve*/)) != null) {
+- TypeDeclaration typeDecl = this.scope.referenceContext;
+- for (int i = 0, max = typeDecl.fields.length; i < max; i++) {
+- FieldDeclaration fieldDecl = typeDecl.fields[i];
+- if (fieldDecl.binding == existingField) {
+- synthField.name = CharOperation.concat(
+- TypeConstants.SYNTHETIC_ASSERT_DISABLED,
+- ("_" + String.valueOf(index++)).toCharArray()); //$NON-NLS-1$
+- needRecheck = true;
+- break;
+- }
+- }
+- }
+- } while (needRecheck);
+- return synthField;
++ FieldBinding synthField = (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get("assertionEmulation"); //$NON-NLS-1$
++ if (synthField == null) {
++ synthField = new SyntheticFieldBinding(
++ TypeConstants.SYNTHETIC_ASSERT_DISABLED,
++ TypeBinding.BOOLEAN,
++ ClassFileConstants.AccDefault | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic | ClassFileConstants.AccFinal,
++ this,
++ Constant.NotAConstant,
++ this.synthetics[SourceTypeBinding.FIELD_EMUL].size());
++ this.synthetics[SourceTypeBinding.FIELD_EMUL].put("assertionEmulation", synthField); //$NON-NLS-1$
++ }
++ // ensure there is not already such a field defined by the user
++ // ensure there is not already such a field defined by the user
++ boolean needRecheck;
++ int index = 0;
++ do {
++ needRecheck = false;
++ FieldBinding existingField;
++ if ((existingField = getField(synthField.name, true /*resolve*/)) != null) {
++ TypeDeclaration typeDecl = this.scope.referenceContext;
++ for (int i = 0, max = typeDecl.fields.length; i < max; i++) {
++ FieldDeclaration fieldDecl = typeDecl.fields[i];
++ if (fieldDecl.binding == existingField) {
++ synthField.name = CharOperation.concat(
++ TypeConstants.SYNTHETIC_ASSERT_DISABLED,
++ ("_" + String.valueOf(index++)).toCharArray()); //$NON-NLS-1$
++ needRecheck = true;
++ break;
++ }
++ }
++ }
++ } while (needRecheck);
++ return synthField;
+ }
+ /* Add a new synthetic field for recording all enum constant values
+-* Answer the new field or the existing field if one already existed.
++* Answer the new field or the existing field if one already existed.
+ */
+ public FieldBinding addSyntheticFieldForEnumValues() {
+- if (this.synthetics == null)
+- this.synthetics = new HashMap[MAX_SYNTHETICS];
+- if (this.synthetics[SourceTypeBinding.FIELD_EMUL] == null)
++ if (this.synthetics == null)
++ this.synthetics = new HashMap[MAX_SYNTHETICS];
++ if (this.synthetics[SourceTypeBinding.FIELD_EMUL] == null)
+ this.synthetics[SourceTypeBinding.FIELD_EMUL] = new HashMap();
+
+- FieldBinding synthField = (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get("enumConstantValues"); //$NON-NLS-1$
+- if (synthField == null) {
+- synthField = new SyntheticFieldBinding(
+- TypeConstants.SYNTHETIC_ENUM_VALUES,
+- this.scope.createArrayType(this,1),
+- ClassFileConstants.AccPrivate | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic | ClassFileConstants.AccFinal,
+- this,
+- Constant.NotAConstant,
+- this.synthetics[SourceTypeBinding.FIELD_EMUL].size());
+- this.synthetics[SourceTypeBinding.FIELD_EMUL].put("enumConstantValues", synthField); //$NON-NLS-1$
+- }
+- // ensure there is not already such a field defined by the user
+- // ensure there is not already such a field defined by the user
+- boolean needRecheck;
+- int index = 0;
+- do {
+- needRecheck = false;
+- FieldBinding existingField;
+- if ((existingField = this.getField(synthField.name, true /*resolve*/)) != null) {
+- TypeDeclaration typeDecl = this.scope.referenceContext;
+- for (int i = 0, max = typeDecl.fields.length; i < max; i++) {
+- FieldDeclaration fieldDecl = typeDecl.fields[i];
+- if (fieldDecl.binding == existingField) {
+- synthField.name = CharOperation.concat(
+- TypeConstants.SYNTHETIC_ENUM_VALUES,
+- ("_" + String.valueOf(index++)).toCharArray()); //$NON-NLS-1$
+- needRecheck = true;
+- break;
+- }
+- }
+- }
+- } while (needRecheck);
+- return synthField;
++ FieldBinding synthField = (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get("enumConstantValues"); //$NON-NLS-1$
++ if (synthField == null) {
++ synthField = new SyntheticFieldBinding(
++ TypeConstants.SYNTHETIC_ENUM_VALUES,
++ this.scope.createArrayType(this,1),
++ ClassFileConstants.AccPrivate | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic | ClassFileConstants.AccFinal,
++ this,
++ Constant.NotAConstant,
++ this.synthetics[SourceTypeBinding.FIELD_EMUL].size());
++ this.synthetics[SourceTypeBinding.FIELD_EMUL].put("enumConstantValues", synthField); //$NON-NLS-1$
++ }
++ // ensure there is not already such a field defined by the user
++ // ensure there is not already such a field defined by the user
++ boolean needRecheck;
++ int index = 0;
++ do {
++ needRecheck = false;
++ FieldBinding existingField;
++ if ((existingField = getField(synthField.name, true /*resolve*/)) != null) {
++ TypeDeclaration typeDecl = this.scope.referenceContext;
++ for (int i = 0, max = typeDecl.fields.length; i < max; i++) {
++ FieldDeclaration fieldDecl = typeDecl.fields[i];
++ if (fieldDecl.binding == existingField) {
++ synthField.name = CharOperation.concat(
++ TypeConstants.SYNTHETIC_ENUM_VALUES,
++ ("_" + String.valueOf(index++)).toCharArray()); //$NON-NLS-1$
++ needRecheck = true;
++ break;
++ }
++ }
++ }
++ } while (needRecheck);
++ return synthField;
+ }
+ /* Add a new synthetic access method for read/write access to <targetField>.
+- Answer the new method or the existing method if one already existed.
++ Answer the new method or the existing method if one already existed.
+ */
+-public SyntheticMethodBinding addSyntheticMethod(FieldBinding targetField, boolean isReadAccess) {
+- if (this.synthetics == null)
+- this.synthetics = new HashMap[MAX_SYNTHETICS];
+- if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null)
++public SyntheticMethodBinding addSyntheticMethod(FieldBinding targetField, boolean isReadAccess, boolean isSuperAccess) {
++ if (this.synthetics == null)
++ this.synthetics = new HashMap[MAX_SYNTHETICS];
++ if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null)
+ this.synthetics[SourceTypeBinding.METHOD_EMUL] = new HashMap();
+
+- SyntheticMethodBinding accessMethod = null;
+- SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(targetField);
+- if (accessors == null) {
+- accessMethod = new SyntheticMethodBinding(targetField, isReadAccess, this);
+- this.synthetics[SourceTypeBinding.METHOD_EMUL].put(targetField, accessors = new SyntheticMethodBinding[2]);
+- accessors[isReadAccess ? 0 : 1] = accessMethod;
+- } else {
+- if ((accessMethod = accessors[isReadAccess ? 0 : 1]) == null) {
+- accessMethod = new SyntheticMethodBinding(targetField, isReadAccess, this);
+- accessors[isReadAccess ? 0 : 1] = accessMethod;
+- }
+- }
+- return accessMethod;
++ SyntheticMethodBinding accessMethod = null;
++ SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(targetField);
++ if (accessors == null) {
++ accessMethod = new SyntheticMethodBinding(targetField, isReadAccess, isSuperAccess, this);
++ this.synthetics[SourceTypeBinding.METHOD_EMUL].put(targetField, accessors = new SyntheticMethodBinding[2]);
++ accessors[isReadAccess ? 0 : 1] = accessMethod;
++ } else {
++ if ((accessMethod = accessors[isReadAccess ? 0 : 1]) == null) {
++ accessMethod = new SyntheticMethodBinding(targetField, isReadAccess, isSuperAccess, this);
++ accessors[isReadAccess ? 0 : 1] = accessMethod;
++ }
++ }
++ return accessMethod;
+ }
+ /* Add a new synthetic method the enum type. Selector can either be 'values' or 'valueOf'.
+ * char[] constants from TypeConstants must be used: TypeConstants.VALUES/VALUEOF
+ */
+ public SyntheticMethodBinding addSyntheticEnumMethod(char[] selector) {
+- if (this.synthetics == null)
+- this.synthetics = new HashMap[MAX_SYNTHETICS];
+- if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null)
++ if (this.synthetics == null)
++ this.synthetics = new HashMap[MAX_SYNTHETICS];
++ if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null)
+ this.synthetics[SourceTypeBinding.METHOD_EMUL] = new HashMap();
+
+- SyntheticMethodBinding accessMethod = null;
+- SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(selector);
+- if (accessors == null) {
+- accessMethod = new SyntheticMethodBinding(this, selector);
+- this.synthetics[SourceTypeBinding.METHOD_EMUL].put(selector, accessors = new SyntheticMethodBinding[2]);
+- accessors[0] = accessMethod;
+- } else {
+- if ((accessMethod = accessors[0]) == null) {
+- accessMethod = new SyntheticMethodBinding(this, selector);
+- accessors[0] = accessMethod;
+- }
+- }
+- return accessMethod;
++ SyntheticMethodBinding accessMethod = null;
++ SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(selector);
++ if (accessors == null) {
++ accessMethod = new SyntheticMethodBinding(this, selector);
++ this.synthetics[SourceTypeBinding.METHOD_EMUL].put(selector, accessors = new SyntheticMethodBinding[2]);
++ accessors[0] = accessMethod;
++ } else {
++ if ((accessMethod = accessors[0]) == null) {
++ accessMethod = new SyntheticMethodBinding(this, selector);
++ accessors[0] = accessMethod;
++ }
++ }
++ return accessMethod;
+ }
+ /*
+- * Add a synthetic field to handle the cache of the switch translation table for the corresponding enum type
++ * Add a synthetic field to handle the cache of the switch translation table for the corresponding enum type
+ */
+ public SyntheticFieldBinding addSyntheticFieldForSwitchEnum(char[] fieldName, String key) {
+- if (this.synthetics == null)
+- this.synthetics = new HashMap[MAX_SYNTHETICS];
+- if (this.synthetics[SourceTypeBinding.FIELD_EMUL] == null)
++ if (this.synthetics == null)
++ this.synthetics = new HashMap[MAX_SYNTHETICS];
++ if (this.synthetics[SourceTypeBinding.FIELD_EMUL] == null)
+ this.synthetics[SourceTypeBinding.FIELD_EMUL] = new HashMap();
+
+- SyntheticFieldBinding synthField = (SyntheticFieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get(key);
+- if (synthField == null) {
+- synthField = new SyntheticFieldBinding(
+- fieldName,
+- this.scope.createArrayType(TypeBinding.INT,1),
+- ClassFileConstants.AccPrivate | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic,
+- this,
+- Constant.NotAConstant,
+- this.synthetics[SourceTypeBinding.FIELD_EMUL].size());
+- this.synthetics[SourceTypeBinding.FIELD_EMUL].put(key, synthField);
+- }
+- // ensure there is not already such a field defined by the user
+- boolean needRecheck;
+- int index = 0;
+- do {
+- needRecheck = false;
+- FieldBinding existingField;
+- if ((existingField = this.getField(synthField.name, true /*resolve*/)) != null) {
+- TypeDeclaration typeDecl = this.scope.referenceContext;
+- for (int i = 0, max = typeDecl.fields.length; i < max; i++) {
+- FieldDeclaration fieldDecl = typeDecl.fields[i];
+- if (fieldDecl.binding == existingField) {
+- synthField.name = CharOperation.concat(
+- fieldName,
+- ("_" + String.valueOf(index++)).toCharArray()); //$NON-NLS-1$
+- needRecheck = true;
+- break;
+- }
+- }
+- }
+- } while (needRecheck);
+- return synthField;
++ SyntheticFieldBinding synthField = (SyntheticFieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get(key);
++ if (synthField == null) {
++ synthField = new SyntheticFieldBinding(
++ fieldName,
++ this.scope.createArrayType(TypeBinding.INT,1),
++ ClassFileConstants.AccPrivate | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic,
++ this,
++ Constant.NotAConstant,
++ this.synthetics[SourceTypeBinding.FIELD_EMUL].size());
++ this.synthetics[SourceTypeBinding.FIELD_EMUL].put(key, synthField);
++ }
++ // ensure there is not already such a field defined by the user
++ boolean needRecheck;
++ int index = 0;
++ do {
++ needRecheck = false;
++ FieldBinding existingField;
++ if ((existingField = getField(synthField.name, true /*resolve*/)) != null) {
++ TypeDeclaration typeDecl = this.scope.referenceContext;
++ for (int i = 0, max = typeDecl.fields.length; i < max; i++) {
++ FieldDeclaration fieldDecl = typeDecl.fields[i];
++ if (fieldDecl.binding == existingField) {
++ synthField.name = CharOperation.concat(
++ fieldName,
++ ("_" + String.valueOf(index++)).toCharArray()); //$NON-NLS-1$
++ needRecheck = true;
++ break;
++ }
++ }
++ }
++ } while (needRecheck);
++ return synthField;
+ }
+ /* Add a new synthetic method the enum type. Selector can either be 'values' or 'valueOf'.
+ * char[] constants from TypeConstants must be used: TypeConstants.VALUES/VALUEOF
+ */
+ public SyntheticMethodBinding addSyntheticMethodForSwitchEnum(TypeBinding enumBinding) {
+- if (this.synthetics == null)
+- this.synthetics = new HashMap[MAX_SYNTHETICS];
+- if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null)
++ if (this.synthetics == null)
++ this.synthetics = new HashMap[MAX_SYNTHETICS];
++ if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null)
+ this.synthetics[SourceTypeBinding.METHOD_EMUL] = new HashMap();
+
+- SyntheticMethodBinding accessMethod = null;
+- char[] selector = CharOperation.concat(TypeConstants.SYNTHETIC_SWITCH_ENUM_TABLE, enumBinding.constantPoolName());
+- CharOperation.replace(selector, '/', '$');
+- final String key = new String(selector);
+- SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(key);
+- // first add the corresponding synthetic field
+- if (accessors == null) {
+- // then create the synthetic method
+- final SyntheticFieldBinding fieldBinding = this.addSyntheticFieldForSwitchEnum(selector, key);
+- accessMethod = new SyntheticMethodBinding(fieldBinding, this, enumBinding, selector);
+- this.synthetics[SourceTypeBinding.METHOD_EMUL].put(key, accessors = new SyntheticMethodBinding[2]);
+- accessors[0] = accessMethod;
+- } else {
+- if ((accessMethod = accessors[0]) == null) {
+- final SyntheticFieldBinding fieldBinding = this.addSyntheticFieldForSwitchEnum(selector, key);
+- accessMethod = new SyntheticMethodBinding(fieldBinding, this, enumBinding, selector);
+- accessors[0] = accessMethod;
+- }
+- }
+- return accessMethod;
++ SyntheticMethodBinding accessMethod = null;
++ char[] selector = CharOperation.concat(TypeConstants.SYNTHETIC_SWITCH_ENUM_TABLE, enumBinding.constantPoolName());
++ CharOperation.replace(selector, '/', '$');
++ final String key = new String(selector);
++ SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(key);
++ // first add the corresponding synthetic field
++ if (accessors == null) {
++ // then create the synthetic method
++ final SyntheticFieldBinding fieldBinding = addSyntheticFieldForSwitchEnum(selector, key);
++ accessMethod = new SyntheticMethodBinding(fieldBinding, this, enumBinding, selector);
++ this.synthetics[SourceTypeBinding.METHOD_EMUL].put(key, accessors = new SyntheticMethodBinding[2]);
++ accessors[0] = accessMethod;
++ } else {
++ if ((accessMethod = accessors[0]) == null) {
++ final SyntheticFieldBinding fieldBinding = addSyntheticFieldForSwitchEnum(selector, key);
++ accessMethod = new SyntheticMethodBinding(fieldBinding, this, enumBinding, selector);
++ accessors[0] = accessMethod;
++ }
++ }
++ return accessMethod;
+ }
+ /* Add a new synthetic access method for access to <targetMethod>.
+ * Must distinguish access method used for super access from others (need to use invokespecial bytecode)
+- Answer the new method or the existing method if one already existed.
++ Answer the new method or the existing method if one already existed.
+ */
+ public SyntheticMethodBinding addSyntheticMethod(MethodBinding targetMethod, boolean isSuperAccess) {
+- if (this.synthetics == null)
+- this.synthetics = new HashMap[MAX_SYNTHETICS];
+- if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null)
++ if (this.synthetics == null)
++ this.synthetics = new HashMap[MAX_SYNTHETICS];
++ if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null)
+ this.synthetics[SourceTypeBinding.METHOD_EMUL] = new HashMap();
+
+- SyntheticMethodBinding accessMethod = null;
+- SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(targetMethod);
+- if (accessors == null) {
+- accessMethod = new SyntheticMethodBinding(targetMethod, isSuperAccess, this);
+- this.synthetics[SourceTypeBinding.METHOD_EMUL].put(targetMethod, accessors = new SyntheticMethodBinding[2]);
+- accessors[isSuperAccess ? 0 : 1] = accessMethod;
+- } else {
+- if ((accessMethod = accessors[isSuperAccess ? 0 : 1]) == null) {
+- accessMethod = new SyntheticMethodBinding(targetMethod, isSuperAccess, this);
+- accessors[isSuperAccess ? 0 : 1] = accessMethod;
+- }
+- }
+- return accessMethod;
++ SyntheticMethodBinding accessMethod = null;
++ SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(targetMethod);
++ if (accessors == null) {
++ accessMethod = new SyntheticMethodBinding(targetMethod, isSuperAccess, this);
++ this.synthetics[SourceTypeBinding.METHOD_EMUL].put(targetMethod, accessors = new SyntheticMethodBinding[2]);
++ accessors[isSuperAccess ? 0 : 1] = accessMethod;
++ } else {
++ if ((accessMethod = accessors[isSuperAccess ? 0 : 1]) == null) {
++ accessMethod = new SyntheticMethodBinding(targetMethod, isSuperAccess, this);
++ accessors[isSuperAccess ? 0 : 1] = accessMethod;
++ }
++ }
++ return accessMethod;
+ }
+-/*
++/*
+ * Record the fact that bridge methods need to be generated to override certain inherited methods
+ */
+ public SyntheticMethodBinding addSyntheticBridgeMethod(MethodBinding inheritedMethodToBridge, MethodBinding targetMethod) {
+- if (isInterface()) return null; // only classes & enums get bridge methods
+- // targetMethod may be inherited
+- if (inheritedMethodToBridge.returnType.erasure() == targetMethod.returnType.erasure()
+- && inheritedMethodToBridge.areParameterErasuresEqual(targetMethod)) {
+- return null; // do not need bridge method
+- }
+- if (this.synthetics == null)
+- this.synthetics = new HashMap[MAX_SYNTHETICS];
+- if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null) {
++ if (isInterface()) return null; // only classes & enums get bridge methods
++ // targetMethod may be inherited
++ if (inheritedMethodToBridge.returnType.erasure() == targetMethod.returnType.erasure()
++ && inheritedMethodToBridge.areParameterErasuresEqual(targetMethod)) {
++ return null; // do not need bridge method
++ }
++ if (this.synthetics == null)
++ this.synthetics = new HashMap[MAX_SYNTHETICS];
++ if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null) {
+ this.synthetics[SourceTypeBinding.METHOD_EMUL] = new HashMap();
+- } else {
+- // check to see if there is another equivalent inheritedMethod already added
+- Iterator synthMethods = this.synthetics[SourceTypeBinding.METHOD_EMUL].keySet().iterator();
+- while (synthMethods.hasNext()) {
+- Object synthetic = synthMethods.next();
+- if (synthetic instanceof MethodBinding) {
+- MethodBinding method = (MethodBinding) synthetic;
+- if (CharOperation.equals(inheritedMethodToBridge.selector, method.selector)
+- && inheritedMethodToBridge.returnType.erasure() == method.returnType.erasure()
+- && inheritedMethodToBridge.areParameterErasuresEqual(method)) {
+- return null;
+- }
+- }
+- }
+- }
+-
+- SyntheticMethodBinding accessMethod = null;
+- SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(inheritedMethodToBridge);
+- if (accessors == null) {
+- accessMethod = new SyntheticMethodBinding(inheritedMethodToBridge, targetMethod, this);
+- this.synthetics[SourceTypeBinding.METHOD_EMUL].put(inheritedMethodToBridge, accessors = new SyntheticMethodBinding[2]);
+- accessors[1] = accessMethod;
+- } else {
+- if ((accessMethod = accessors[1]) == null) {
+- accessMethod = new SyntheticMethodBinding(inheritedMethodToBridge, targetMethod, this);
+- accessors[1] = accessMethod;
+- }
+- }
+- return accessMethod;
++ } else {
++ // check to see if there is another equivalent inheritedMethod already added
++ Iterator synthMethods = this.synthetics[SourceTypeBinding.METHOD_EMUL].keySet().iterator();
++ while (synthMethods.hasNext()) {
++ Object synthetic = synthMethods.next();
++ if (synthetic instanceof MethodBinding) {
++ MethodBinding method = (MethodBinding) synthetic;
++ if (CharOperation.equals(inheritedMethodToBridge.selector, method.selector)
++ && inheritedMethodToBridge.returnType.erasure() == method.returnType.erasure()
++ && inheritedMethodToBridge.areParameterErasuresEqual(method)) {
++ return null;
++ }
++ }
++ }
++ }
++
++ SyntheticMethodBinding accessMethod = null;
++ SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(inheritedMethodToBridge);
++ if (accessors == null) {
++ accessMethod = new SyntheticMethodBinding(inheritedMethodToBridge, targetMethod, this);
++ this.synthetics[SourceTypeBinding.METHOD_EMUL].put(inheritedMethodToBridge, accessors = new SyntheticMethodBinding[2]);
++ accessors[1] = accessMethod;
++ } else {
++ if ((accessMethod = accessors[1]) == null) {
++ accessMethod = new SyntheticMethodBinding(inheritedMethodToBridge, targetMethod, this);
++ accessors[1] = accessMethod;
++ }
++ }
++ return accessMethod;
+ }
+ boolean areFieldsInitialized() {
+- return this.fields != Binding.UNINITIALIZED_FIELDS;
++ return this.fields != Binding.UNINITIALIZED_FIELDS;
+ }
+ boolean areMethodsInitialized() {
+- return this.methods != Binding.UNINITIALIZED_METHODS;
++ return this.methods != Binding.UNINITIALIZED_METHODS;
+ }
+ public int kind() {
+- if (this.typeVariables != Binding.NO_TYPE_VARIABLES) return Binding.GENERIC_TYPE;
+- return Binding.TYPE;
++ if (this.typeVariables != Binding.NO_TYPE_VARIABLES) return Binding.GENERIC_TYPE;
++ return Binding.TYPE;
+ }
+
+ public char[] computeUniqueKey(boolean isLeaf) {
+- char[] uniqueKey = super.computeUniqueKey(isLeaf);
+- if (uniqueKey.length == 2) return uniqueKey; // problem type's unique key is "L;"
+- if (Util.isClassFileName(this.fileName)) return uniqueKey; // no need to insert compilation unit name for a .class file
+-
+- // insert compilation unit name if the type name is not the main type name
+- int end = CharOperation.lastIndexOf('.', this.fileName);
+- if (end != -1) {
+- int start = CharOperation.lastIndexOf('/', this.fileName) + 1;
+- char[] mainTypeName = CharOperation.subarray(this.fileName, start, end);
+- start = CharOperation.lastIndexOf('/', uniqueKey) + 1;
+- if (start == 0)
+- start = 1; // start after L
+- end = CharOperation.indexOf('$', uniqueKey, start);
+- if (end == -1)
+- end = CharOperation.indexOf('<', uniqueKey, start);
+- if (end == -1)
+- end = CharOperation.indexOf(';', uniqueKey, start);
+- char[] topLevelType = CharOperation.subarray(uniqueKey, start, end);
+- if (!CharOperation.equals(topLevelType, mainTypeName)) {
+- StringBuffer buffer = new StringBuffer();
+- buffer.append(uniqueKey, 0, start);
+- buffer.append(mainTypeName);
+- buffer.append('~');
+- buffer.append(topLevelType);
+- buffer.append(uniqueKey, end, uniqueKey.length - end);
+- int length = buffer.length();
+- uniqueKey = new char[length];
+- buffer.getChars(0, length, uniqueKey, 0);
+- return uniqueKey;
+- }
+- }
+- return uniqueKey;
++ char[] uniqueKey = super.computeUniqueKey(isLeaf);
++ if (uniqueKey.length == 2) return uniqueKey; // problem type's unique key is "L;"
++ if (Util.isClassFileName(this.fileName)) return uniqueKey; // no need to insert compilation unit name for a .class file
++
++ // insert compilation unit name if the type name is not the main type name
++ int end = CharOperation.lastIndexOf('.', this.fileName);
++ if (end != -1) {
++ int start = CharOperation.lastIndexOf('/', this.fileName) + 1;
++ char[] mainTypeName = CharOperation.subarray(this.fileName, start, end);
++ start = CharOperation.lastIndexOf('/', uniqueKey) + 1;
++ if (start == 0)
++ start = 1; // start after L
++ end = CharOperation.indexOf('$', uniqueKey, start);
++ if (end == -1)
++ end = CharOperation.indexOf('<', uniqueKey, start);
++ if (end == -1)
++ end = CharOperation.indexOf(';', uniqueKey, start);
++ char[] topLevelType = CharOperation.subarray(uniqueKey, start, end);
++ if (!CharOperation.equals(topLevelType, mainTypeName)) {
++ StringBuffer buffer = new StringBuffer();
++ buffer.append(uniqueKey, 0, start);
++ buffer.append(mainTypeName);
++ buffer.append('~');
++ buffer.append(topLevelType);
++ buffer.append(uniqueKey, end, uniqueKey.length - end);
++ int length = buffer.length();
++ uniqueKey = new char[length];
++ buffer.getChars(0, length, uniqueKey, 0);
++ return uniqueKey;
++ }
++ }
++ return uniqueKey;
+ }
+
+ void faultInTypesForFieldsAndMethods() {
+- // check @Deprecated annotation
+- getAnnotationTagBits(); // marks as deprecated by side effect
+- ReferenceBinding enclosingType = this.enclosingType();
+- if (enclosingType != null && enclosingType.isViewedAsDeprecated() && !this.isDeprecated())
+- this.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
+- fields();
+- methods();
++ // check @Deprecated annotation
++ getAnnotationTagBits(); // marks as deprecated by side effect
++ ReferenceBinding enclosingType = enclosingType();
++ if (enclosingType != null && enclosingType.isViewedAsDeprecated() && !isDeprecated())
++ this.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
++ fields();
++ methods();
+
+- for (int i = 0, length = this.memberTypes.length; i < length; i++)
+- ((SourceTypeBinding) this.memberTypes[i]).faultInTypesForFieldsAndMethods();
++ for (int i = 0, length = this.memberTypes.length; i < length; i++)
++ ((SourceTypeBinding) this.memberTypes[i]).faultInTypesForFieldsAndMethods();
+ }
+ // NOTE: the type of each field of a source type is resolved when needed
+ public FieldBinding[] fields() {
+- if ((this.tagBits & TagBits.AreFieldsComplete) != 0)
+- return this.fields;
++ if ((this.tagBits & TagBits.AreFieldsComplete) != 0)
++ return this.fields;
+
+- int failed = 0;
+- FieldBinding[] resolvedFields = this.fields;
+- try {
+- // lazily sort fields
+- if ((this.tagBits & TagBits.AreFieldsSorted) == 0) {
+- int length = this.fields.length;
+- if (length > 1)
+- ReferenceBinding.sortFields(this.fields, 0, length);
+- this.tagBits |= TagBits.AreFieldsSorted;
+- }
+- for (int i = 0, length = this.fields.length; i < length; i++) {
+- if (resolveTypeFor(this.fields[i]) == null) {
+- // do not alter original field array until resolution is over, due to reentrance (143259)
+- if (resolvedFields == this.fields) {
+- System.arraycopy(this.fields, 0, resolvedFields = new FieldBinding[length], 0, length);
+- }
+- resolvedFields[i] = null;
+- failed++;
+- }
+- }
+- } finally {
+- if (failed > 0) {
+- // ensure fields are consistent reqardless of the error
+- int newSize = resolvedFields.length - failed;
+- if (newSize == 0)
+- return this.fields = Binding.NO_FIELDS;
+-
+- FieldBinding[] newFields = new FieldBinding[newSize];
+- for (int i = 0, j = 0, length = resolvedFields.length; i < length; i++) {
+- if (resolvedFields[i] != null)
+- newFields[j++] = resolvedFields[i];
+- }
+- this.fields = newFields;
+- }
+- }
+- this.tagBits |= TagBits.AreFieldsComplete;
+- return this.fields;
++ int failed = 0;
++ FieldBinding[] resolvedFields = this.fields;
++ try {
++ // lazily sort fields
++ if ((this.tagBits & TagBits.AreFieldsSorted) == 0) {
++ int length = this.fields.length;
++ if (length > 1)
++ ReferenceBinding.sortFields(this.fields, 0, length);
++ this.tagBits |= TagBits.AreFieldsSorted;
++ }
++ for (int i = 0, length = this.fields.length; i < length; i++) {
++ if (resolveTypeFor(this.fields[i]) == null) {
++ // do not alter original field array until resolution is over, due to reentrance (143259)
++ if (resolvedFields == this.fields) {
++ System.arraycopy(this.fields, 0, resolvedFields = new FieldBinding[length], 0, length);
++ }
++ resolvedFields[i] = null;
++ failed++;
++ }
++ }
++ } finally {
++ if (failed > 0) {
++ // ensure fields are consistent reqardless of the error
++ int newSize = resolvedFields.length - failed;
++ if (newSize == 0)
++ return this.fields = Binding.NO_FIELDS;
++
++ FieldBinding[] newFields = new FieldBinding[newSize];
++ for (int i = 0, j = 0, length = resolvedFields.length; i < length; i++) {
++ if (resolvedFields[i] != null)
++ newFields[j++] = resolvedFields[i];
++ }
++ this.fields = newFields;
++ }
++ }
++ this.tagBits |= TagBits.AreFieldsComplete;
++ return this.fields;
+ }
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#genericTypeSignature()
+ */
+ public char[] genericTypeSignature() {
+ if (this.genericReferenceTypeSignature == null)
+- this.genericReferenceTypeSignature = computeGenericTypeSignature(this.typeVariables);
++ this.genericReferenceTypeSignature = computeGenericTypeSignature(this.typeVariables);
+ return this.genericReferenceTypeSignature;
+ }
+ /**
+@@ -655,29 +653,29 @@
+ */
+ public char[] genericSignature() {
+ StringBuffer sig = null;
+- if (this.typeVariables != Binding.NO_TYPE_VARIABLES) {
+- sig = new StringBuffer(10);
+- sig.append('<');
+- for (int i = 0, length = this.typeVariables.length; i < length; i++)
+- sig.append(this.typeVariables[i].genericSignature());
+- sig.append('>');
+- } else {
+- // could still need a signature if any of supertypes is parameterized
+- noSignature: if (this.superclass == null || !this.superclass.isParameterizedType()) {
+- for (int i = 0, length = this.superInterfaces.length; i < length; i++)
+- if (this.superInterfaces[i].isParameterizedType())
+- break noSignature;
+- return null;
+- }
+- sig = new StringBuffer(10);
+- }
+- if (this.superclass != null)
+- sig.append(this.superclass.genericTypeSignature());
+- else // interface scenario only (as Object cannot be generic) - 65953
+- sig.append(this.scope.getJavaLangObject().genericTypeSignature());
++ if (this.typeVariables != Binding.NO_TYPE_VARIABLES) {
++ sig = new StringBuffer(10);
++ sig.append('<');
++ for (int i = 0, length = this.typeVariables.length; i < length; i++)
++ sig.append(this.typeVariables[i].genericSignature());
++ sig.append('>');
++ } else {
++ // could still need a signature if any of supertypes is parameterized
++ noSignature: if (this.superclass == null || !this.superclass.isParameterizedType()) {
++ for (int i = 0, length = this.superInterfaces.length; i < length; i++)
++ if (this.superInterfaces[i].isParameterizedType())
++ break noSignature;
++ return null;
++ }
++ sig = new StringBuffer(10);
++ }
++ if (this.superclass != null)
++ sig.append(this.superclass.genericTypeSignature());
++ else // interface scenario only (as Object cannot be generic) - 65953
++ sig.append(this.scope.getJavaLangObject().genericTypeSignature());
+ for (int i = 0, length = this.superInterfaces.length; i < length; i++)
+ sig.append(this.superInterfaces[i].genericTypeSignature());
+- return sig.toString().toCharArray();
++ return sig.toString().toCharArray();
+ }
+
+ /**
+@@ -686,330 +684,330 @@
+ * @see org.eclipse.jdt.internal.compiler.lookup.Binding#getAnnotationTagBits()
+ */
+ public long getAnnotationTagBits() {
+- if ((this.tagBits & TagBits.AnnotationResolved) == 0 && this.scope != null) {
+- TypeDeclaration typeDecl = this.scope.referenceContext;
+- boolean old = typeDecl.staticInitializerScope.insideTypeAnnotation;
+- try {
+- typeDecl.staticInitializerScope.insideTypeAnnotation = true;
+- ASTNode.resolveAnnotations(typeDecl.staticInitializerScope, typeDecl.annotations, this);
+- } finally {
+- typeDecl.staticInitializerScope.insideTypeAnnotation = old;
+- }
+- if ((this.tagBits & TagBits.AnnotationDeprecated) != 0)
+- this.modifiers |= ClassFileConstants.AccDeprecated;
+- }
+- return this.tagBits;
++ if ((this.tagBits & TagBits.AnnotationResolved) == 0 && this.scope != null) {
++ TypeDeclaration typeDecl = this.scope.referenceContext;
++ boolean old = typeDecl.staticInitializerScope.insideTypeAnnotation;
++ try {
++ typeDecl.staticInitializerScope.insideTypeAnnotation = true;
++ ASTNode.resolveAnnotations(typeDecl.staticInitializerScope, typeDecl.annotations, this);
++ } finally {
++ typeDecl.staticInitializerScope.insideTypeAnnotation = old;
++ }
++ if ((this.tagBits & TagBits.AnnotationDeprecated) != 0)
++ this.modifiers |= ClassFileConstants.AccDeprecated;
++ }
++ return this.tagBits;
+ }
+ public MethodBinding[] getDefaultAbstractMethods() {
+- int count = 0;
+- for (int i = this.methods.length; --i >= 0;)
+- if (this.methods[i].isDefaultAbstract())
+- count++;
+- if (count == 0) return Binding.NO_METHODS;
+-
+- MethodBinding[] result = new MethodBinding[count];
+- count = 0;
+- for (int i = this.methods.length; --i >= 0;)
+- if (this.methods[i].isDefaultAbstract())
+- result[count++] = this.methods[i];
+- return result;
++ int count = 0;
++ for (int i = this.methods.length; --i >= 0;)
++ if (this.methods[i].isDefaultAbstract())
++ count++;
++ if (count == 0) return Binding.NO_METHODS;
++
++ MethodBinding[] result = new MethodBinding[count];
++ count = 0;
++ for (int i = this.methods.length; --i >= 0;)
++ if (this.methods[i].isDefaultAbstract())
++ result[count++] = this.methods[i];
++ return result;
+ }
+ // NOTE: the return type, arg & exception types of each method of a source type are resolved when needed
+ public MethodBinding getExactConstructor(TypeBinding[] argumentTypes) {
+- int argCount = argumentTypes.length;
+- if ((this.tagBits & TagBits.AreMethodsComplete) != 0) { // have resolved all arg types & return type of the methods
+- long range;
+- if ((range = ReferenceBinding.binarySearch(TypeConstants.INIT, this.methods)) >= 0) {
+- nextMethod: for (int imethod = (int)range, end = (int)(range >> 32); imethod <= end; imethod++) {
+- MethodBinding method = this.methods[imethod];
+- if (method.parameters.length == argCount) {
+- TypeBinding[] toMatch = method.parameters;
+- for (int iarg = 0; iarg < argCount; iarg++)
+- if (toMatch[iarg] != argumentTypes[iarg])
+- continue nextMethod;
+- return method;
+- }
+- }
+- }
+- } else {
+- // lazily sort methods
+- if ((this.tagBits & TagBits.AreMethodsSorted) == 0) {
+- int length = this.methods.length;
+- if (length > 1)
+- ReferenceBinding.sortMethods(this.methods, 0, length);
+- this.tagBits |= TagBits.AreMethodsSorted;
+- }
+- long range;
+- if ((range = ReferenceBinding.binarySearch(TypeConstants.INIT, this.methods)) >= 0) {
+- nextMethod: for (int imethod = (int)range, end = (int)(range >> 32); imethod <= end; imethod++) {
+- MethodBinding method = this.methods[imethod];
+- if (resolveTypesFor(method) == null || method.returnType == null) {
+- methods();
+- return getExactConstructor(argumentTypes); // try again since the problem methods have been removed
+- }
+- if (method.parameters.length == argCount) {
+- TypeBinding[] toMatch = method.parameters;
+- for (int iarg = 0; iarg < argCount; iarg++)
+- if (toMatch[iarg] != argumentTypes[iarg])
+- continue nextMethod;
+- return method;
+- }
+- }
+- }
+- }
+- return null;
++ int argCount = argumentTypes.length;
++ if ((this.tagBits & TagBits.AreMethodsComplete) != 0) { // have resolved all arg types & return type of the methods
++ long range;
++ if ((range = ReferenceBinding.binarySearch(TypeConstants.INIT, this.methods)) >= 0) {
++ nextMethod: for (int imethod = (int)range, end = (int)(range >> 32); imethod <= end; imethod++) {
++ MethodBinding method = this.methods[imethod];
++ if (method.parameters.length == argCount) {
++ TypeBinding[] toMatch = method.parameters;
++ for (int iarg = 0; iarg < argCount; iarg++)
++ if (toMatch[iarg] != argumentTypes[iarg])
++ continue nextMethod;
++ return method;
++ }
++ }
++ }
++ } else {
++ // lazily sort methods
++ if ((this.tagBits & TagBits.AreMethodsSorted) == 0) {
++ int length = this.methods.length;
++ if (length > 1)
++ ReferenceBinding.sortMethods(this.methods, 0, length);
++ this.tagBits |= TagBits.AreMethodsSorted;
++ }
++ long range;
++ if ((range = ReferenceBinding.binarySearch(TypeConstants.INIT, this.methods)) >= 0) {
++ nextMethod: for (int imethod = (int)range, end = (int)(range >> 32); imethod <= end; imethod++) {
++ MethodBinding method = this.methods[imethod];
++ if (resolveTypesFor(method) == null || method.returnType == null) {
++ methods();
++ return getExactConstructor(argumentTypes); // try again since the problem methods have been removed
++ }
++ if (method.parameters.length == argCount) {
++ TypeBinding[] toMatch = method.parameters;
++ for (int iarg = 0; iarg < argCount; iarg++)
++ if (toMatch[iarg] != argumentTypes[iarg])
++ continue nextMethod;
++ return method;
++ }
++ }
++ }
++ }
++ return null;
+ }
+
+ //NOTE: the return type, arg & exception types of each method of a source type are resolved when needed
+ //searches up the hierarchy as long as no potential (but not exact) match was found.
+ public MethodBinding getExactMethod(char[] selector, TypeBinding[] argumentTypes, CompilationUnitScope refScope) {
+- // sender from refScope calls recordTypeReference(this)
+- int argCount = argumentTypes.length;
+- boolean foundNothing = true;
+-
+- if ((this.tagBits & TagBits.AreMethodsComplete) != 0) { // have resolved all arg types & return type of the methods
+- long range;
+- if ((range = ReferenceBinding.binarySearch(selector, this.methods)) >= 0) {
+- nextMethod: for (int imethod = (int)range, end = (int)(range >> 32); imethod <= end; imethod++) {
+- MethodBinding method = this.methods[imethod];
+- foundNothing = false; // inner type lookups must know that a method with this name exists
+- if (method.parameters.length == argCount) {
+- TypeBinding[] toMatch = method.parameters;
+- for (int iarg = 0; iarg < argCount; iarg++)
+- if (toMatch[iarg] != argumentTypes[iarg])
+- continue nextMethod;
+- return method;
+- }
+- }
+- }
+- } else {
+- // lazily sort methods
+- if ((this.tagBits & TagBits.AreMethodsSorted) == 0) {
+- int length = this.methods.length;
+- if (length > 1)
+- ReferenceBinding.sortMethods(this.methods, 0, length);
+- this.tagBits |= TagBits.AreMethodsSorted;
+- }
+-
+- long range;
+- if ((range = ReferenceBinding.binarySearch(selector, this.methods)) >= 0) {
+- // check unresolved method
+- int start = (int) range, end = (int) (range >> 32);
+- for (int imethod = start; imethod <= end; imethod++) {
+- MethodBinding method = this.methods[imethod];
+- if (resolveTypesFor(method) == null || method.returnType == null) {
+- methods();
+- return getExactMethod(selector, argumentTypes, refScope); // try again since the problem methods have been removed
+- }
+- }
+- // check dup collisions
+- boolean isSource15 = this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5;
+- for (int i = start; i <= end; i++) {
+- MethodBinding method1 = this.methods[i];
+- for (int j = end; j > i; j--) {
+- MethodBinding method2 = this.methods[j];
+- boolean paramsMatch = isSource15
+- ? method1.areParameterErasuresEqual(method2)
+- : method1.areParametersEqual(method2);
+- if (paramsMatch) {
+- methods();
+- return getExactMethod(selector, argumentTypes, refScope); // try again since the problem methods have been removed
+- }
+- }
+- }
+- nextMethod: for (int imethod = start; imethod <= end; imethod++) {
+- MethodBinding method = this.methods[imethod];
+- TypeBinding[] toMatch = method.parameters;
+- if (toMatch.length == argCount) {
+- for (int iarg = 0; iarg < argCount; iarg++)
+- if (toMatch[iarg] != argumentTypes[iarg])
+- continue nextMethod;
+- return method;
+- }
+- }
+- }
+- }
+-
+- if (foundNothing) {
+- if (isInterface()) {
+- if (this.superInterfaces.length == 1) {
+- if (refScope != null)
+- refScope.recordTypeReference(this.superInterfaces[0]);
+- return this.superInterfaces[0].getExactMethod(selector, argumentTypes, refScope);
+- }
+- } else if (this.superclass != null) {
+- if (refScope != null)
+- refScope.recordTypeReference(this.superclass);
+- return this.superclass.getExactMethod(selector, argumentTypes, refScope);
+- }
+- }
+- return null;
++ // sender from refScope calls recordTypeReference(this)
++ int argCount = argumentTypes.length;
++ boolean foundNothing = true;
++
++ if ((this.tagBits & TagBits.AreMethodsComplete) != 0) { // have resolved all arg types & return type of the methods
++ long range;
++ if ((range = ReferenceBinding.binarySearch(selector, this.methods)) >= 0) {
++ nextMethod: for (int imethod = (int)range, end = (int)(range >> 32); imethod <= end; imethod++) {
++ MethodBinding method = this.methods[imethod];
++ foundNothing = false; // inner type lookups must know that a method with this name exists
++ if (method.parameters.length == argCount) {
++ TypeBinding[] toMatch = method.parameters;
++ for (int iarg = 0; iarg < argCount; iarg++)
++ if (toMatch[iarg] != argumentTypes[iarg])
++ continue nextMethod;
++ return method;
++ }
++ }
++ }
++ } else {
++ // lazily sort methods
++ if ((this.tagBits & TagBits.AreMethodsSorted) == 0) {
++ int length = this.methods.length;
++ if (length > 1)
++ ReferenceBinding.sortMethods(this.methods, 0, length);
++ this.tagBits |= TagBits.AreMethodsSorted;
++ }
++
++ long range;
++ if ((range = ReferenceBinding.binarySearch(selector, this.methods)) >= 0) {
++ // check unresolved method
++ int start = (int) range, end = (int) (range >> 32);
++ for (int imethod = start; imethod <= end; imethod++) {
++ MethodBinding method = this.methods[imethod];
++ if (resolveTypesFor(method) == null || method.returnType == null) {
++ methods();
++ return getExactMethod(selector, argumentTypes, refScope); // try again since the problem methods have been removed
++ }
++ }
++ // check dup collisions
++ boolean isSource15 = this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5;
++ for (int i = start; i <= end; i++) {
++ MethodBinding method1 = this.methods[i];
++ for (int j = end; j > i; j--) {
++ MethodBinding method2 = this.methods[j];
++ boolean paramsMatch = isSource15
++ ? method1.areParameterErasuresEqual(method2)
++ : method1.areParametersEqual(method2);
++ if (paramsMatch) {
++ methods();
++ return getExactMethod(selector, argumentTypes, refScope); // try again since the problem methods have been removed
++ }
++ }
++ }
++ nextMethod: for (int imethod = start; imethod <= end; imethod++) {
++ MethodBinding method = this.methods[imethod];
++ TypeBinding[] toMatch = method.parameters;
++ if (toMatch.length == argCount) {
++ for (int iarg = 0; iarg < argCount; iarg++)
++ if (toMatch[iarg] != argumentTypes[iarg])
++ continue nextMethod;
++ return method;
++ }
++ }
++ }
++ }
++
++ if (foundNothing) {
++ if (isInterface()) {
++ if (this.superInterfaces.length == 1) {
++ if (refScope != null)
++ refScope.recordTypeReference(this.superInterfaces[0]);
++ return this.superInterfaces[0].getExactMethod(selector, argumentTypes, refScope);
++ }
++ } else if (this.superclass != null) {
++ if (refScope != null)
++ refScope.recordTypeReference(this.superclass);
++ return this.superclass.getExactMethod(selector, argumentTypes, refScope);
++ }
++ }
++ return null;
+ }
+
+ //NOTE: the type of a field of a source type is resolved when needed
+ public FieldBinding getField(char[] fieldName, boolean needResolve) {
+-
+- if ((this.tagBits & TagBits.AreFieldsComplete) != 0)
+- return ReferenceBinding.binarySearch(fieldName, this.fields);
+-
+- // lazily sort fields
+- if ((this.tagBits & TagBits.AreFieldsSorted) == 0) {
+- int length = this.fields.length;
+- if (length > 1)
+- ReferenceBinding.sortFields(this.fields, 0, length);
+- this.tagBits |= TagBits.AreFieldsSorted;
+- }
+- // always resolve anyway on source types
+- FieldBinding field = ReferenceBinding.binarySearch(fieldName, this.fields);
+- if (field != null) {
+- FieldBinding result = null;
+- try {
+- result = resolveTypeFor(field);
+- return result;
+- } finally {
+- if (result == null) {
+- // ensure fields are consistent reqardless of the error
+- int newSize = this.fields.length - 1;
+- if (newSize == 0) {
+- this.fields = Binding.NO_FIELDS;
+- } else {
+- FieldBinding[] newFields = new FieldBinding[newSize];
+- int index = 0;
+- for (int i = 0, length = this.fields.length; i < length; i++) {
+- FieldBinding f = this.fields[i];
+- if (f == field) continue;
+- newFields[index++] = f;
+- }
+- this.fields = newFields;
+- }
+- }
+- }
+- }
+- return null;
++
++ if ((this.tagBits & TagBits.AreFieldsComplete) != 0)
++ return ReferenceBinding.binarySearch(fieldName, this.fields);
++
++ // lazily sort fields
++ if ((this.tagBits & TagBits.AreFieldsSorted) == 0) {
++ int length = this.fields.length;
++ if (length > 1)
++ ReferenceBinding.sortFields(this.fields, 0, length);
++ this.tagBits |= TagBits.AreFieldsSorted;
++ }
++ // always resolve anyway on source types
++ FieldBinding field = ReferenceBinding.binarySearch(fieldName, this.fields);
++ if (field != null) {
++ FieldBinding result = null;
++ try {
++ result = resolveTypeFor(field);
++ return result;
++ } finally {
++ if (result == null) {
++ // ensure fields are consistent reqardless of the error
++ int newSize = this.fields.length - 1;
++ if (newSize == 0) {
++ this.fields = Binding.NO_FIELDS;
++ } else {
++ FieldBinding[] newFields = new FieldBinding[newSize];
++ int index = 0;
++ for (int i = 0, length = this.fields.length; i < length; i++) {
++ FieldBinding f = this.fields[i];
++ if (f == field) continue;
++ newFields[index++] = f;
++ }
++ this.fields = newFields;
++ }
++ }
++ }
++ }
++ return null;
+ }
+
+ // NOTE: the return type, arg & exception types of each method of a source type are resolved when needed
+ public MethodBinding[] getMethods(char[] selector) {
+- if ((this.tagBits & TagBits.AreMethodsComplete) != 0) {
+- long range;
+- if ((range = ReferenceBinding.binarySearch(selector, this.methods)) >= 0) {
+- int start = (int) range, end = (int) (range >> 32);
+- int length = end - start + 1;
+- MethodBinding[] result;
+- System.arraycopy(this.methods, start, result = new MethodBinding[length], 0, length);
+- return result;
+- } else {
+- return Binding.NO_METHODS;
+- }
+- }
+- // lazily sort methods
+- if ((this.tagBits & TagBits.AreMethodsSorted) == 0) {
+- int length = this.methods.length;
+- if (length > 1)
+- ReferenceBinding.sortMethods(this.methods, 0, length);
+- this.tagBits |= TagBits.AreMethodsSorted;
+- }
+- MethodBinding[] result;
+- long range;
+- if ((range = ReferenceBinding.binarySearch(selector, this.methods)) >= 0) {
+- int start = (int) range, end = (int) (range >> 32);
+- for (int i = start; i <= end; i++) {
+- MethodBinding method = this.methods[i];
+- if (resolveTypesFor(method) == null || method.returnType == null) {
+- methods();
+- return getMethods(selector); // try again since the problem methods have been removed
+- }
+- }
+- int length = end - start + 1;
+- System.arraycopy(this.methods, start, result = new MethodBinding[length], 0, length);
+- } else {
+- return Binding.NO_METHODS;
+- }
+- boolean isSource15 = this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5;
+- for (int i = 0, length = result.length - 1; i < length; i++) {
+- MethodBinding method = result[i];
+- for (int j = length; j > i; j--) {
+- boolean paramsMatch = isSource15
+- ? method.areParameterErasuresEqual(result[j])
+- : method.areParametersEqual(result[j]);
+- if (paramsMatch) {
+- methods();
+- return getMethods(selector); // try again since the duplicate methods have been removed
+- }
+- }
+- }
+- return result;
++ if ((this.tagBits & TagBits.AreMethodsComplete) != 0) {
++ long range;
++ if ((range = ReferenceBinding.binarySearch(selector, this.methods)) >= 0) {
++ int start = (int) range, end = (int) (range >> 32);
++ int length = end - start + 1;
++ MethodBinding[] result;
++ System.arraycopy(this.methods, start, result = new MethodBinding[length], 0, length);
++ return result;
++ } else {
++ return Binding.NO_METHODS;
++ }
++ }
++ // lazily sort methods
++ if ((this.tagBits & TagBits.AreMethodsSorted) == 0) {
++ int length = this.methods.length;
++ if (length > 1)
++ ReferenceBinding.sortMethods(this.methods, 0, length);
++ this.tagBits |= TagBits.AreMethodsSorted;
++ }
++ MethodBinding[] result;
++ long range;
++ if ((range = ReferenceBinding.binarySearch(selector, this.methods)) >= 0) {
++ int start = (int) range, end = (int) (range >> 32);
++ for (int i = start; i <= end; i++) {
++ MethodBinding method = this.methods[i];
++ if (resolveTypesFor(method) == null || method.returnType == null) {
++ methods();
++ return getMethods(selector); // try again since the problem methods have been removed
++ }
++ }
++ int length = end - start + 1;
++ System.arraycopy(this.methods, start, result = new MethodBinding[length], 0, length);
++ } else {
++ return Binding.NO_METHODS;
++ }
++ boolean isSource15 = this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5;
++ for (int i = 0, length = result.length - 1; i < length; i++) {
++ MethodBinding method = result[i];
++ for (int j = length; j > i; j--) {
++ boolean paramsMatch = isSource15
++ ? method.areParameterErasuresEqual(result[j])
++ : method.areParametersEqual(result[j]);
++ if (paramsMatch) {
++ methods();
++ return getMethods(selector); // try again since the duplicate methods have been removed
++ }
++ }
++ }
++ return result;
+ }
+ /* Answer the synthetic field for <actualOuterLocalVariable>
+-* or null if one does not exist.
++* or null if one does not exist.
+ */
+ public FieldBinding getSyntheticField(LocalVariableBinding actualOuterLocalVariable) {
+- if (this.synthetics == null || this.synthetics[SourceTypeBinding.FIELD_EMUL] == null) return null;
+- return (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get(actualOuterLocalVariable);
++ if (this.synthetics == null || this.synthetics[SourceTypeBinding.FIELD_EMUL] == null) return null;
++ return (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get(actualOuterLocalVariable);
+ }
+ /* Answer the synthetic field for <targetEnclosingType>
+-* or null if one does not exist.
++* or null if one does not exist.
+ */
+ public FieldBinding getSyntheticField(ReferenceBinding targetEnclosingType, boolean onlyExactMatch) {
+
+- if (this.synthetics == null || this.synthetics[SourceTypeBinding.FIELD_EMUL] == null) return null;
+- FieldBinding field = (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get(targetEnclosingType);
+- if (field != null) return field;
+-
+- // type compatibility : to handle cases such as
+- // class T { class M{}}
+- // class S extends T { class N extends M {}} --> need to use S as a default enclosing instance for the super constructor call in N().
+- if (!onlyExactMatch){
+- Iterator accessFields = this.synthetics[SourceTypeBinding.FIELD_EMUL].values().iterator();
+- while (accessFields.hasNext()) {
+- field = (FieldBinding) accessFields.next();
+- if (CharOperation.prefixEquals(TypeConstants.SYNTHETIC_ENCLOSING_INSTANCE_PREFIX, field.name)
+- && field.type.findSuperTypeOriginatingFrom(targetEnclosingType) != null)
+- return field;
+- }
+- }
+- return null;
++ if (this.synthetics == null || this.synthetics[SourceTypeBinding.FIELD_EMUL] == null) return null;
++ FieldBinding field = (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get(targetEnclosingType);
++ if (field != null) return field;
++
++ // type compatibility : to handle cases such as
++ // class T { class M{}}
++ // class S extends T { class N extends M {}} --> need to use S as a default enclosing instance for the super constructor call in N().
++ if (!onlyExactMatch){
++ Iterator accessFields = this.synthetics[SourceTypeBinding.FIELD_EMUL].values().iterator();
++ while (accessFields.hasNext()) {
++ field = (FieldBinding) accessFields.next();
++ if (CharOperation.prefixEquals(TypeConstants.SYNTHETIC_ENCLOSING_INSTANCE_PREFIX, field.name)
++ && field.type.findSuperTypeOriginatingFrom(targetEnclosingType) != null)
++ return field;
++ }
++ }
++ return null;
+ }
+-/*
++/*
+ * Answer the bridge method associated for an inherited methods or null if one does not exist
+ */
+ public SyntheticMethodBinding getSyntheticBridgeMethod(MethodBinding inheritedMethodToBridge) {
+- if (this.synthetics == null) return null;
+- if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null) return null;
+- SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(inheritedMethodToBridge);
+- if (accessors == null) return null;
+- return accessors[1];
++ if (this.synthetics == null) return null;
++ if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null) return null;
++ SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(inheritedMethodToBridge);
++ if (accessors == null) return null;
++ return accessors[1];
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.Binding#initializeDeprecatedAnnotationTagBits()
+ */
+ public void initializeDeprecatedAnnotationTagBits() {
+- if ((this.tagBits & TagBits.DeprecatedAnnotationResolved) == 0) {
+- TypeDeclaration typeDecl = this.scope.referenceContext;
+- boolean old = typeDecl.staticInitializerScope.insideTypeAnnotation;
+- try {
+- typeDecl.staticInitializerScope.insideTypeAnnotation = true;
+- ASTNode.resolveDeprecatedAnnotations(typeDecl.staticInitializerScope, typeDecl.annotations, this);
+- this.tagBits |= TagBits.DeprecatedAnnotationResolved;
+- } finally {
+- typeDecl.staticInitializerScope.insideTypeAnnotation = old;
+- }
+- if ((this.tagBits & TagBits.AnnotationDeprecated) != 0) {
+- this.modifiers |= ClassFileConstants.AccDeprecated;
+- }
+- }
++ if ((this.tagBits & TagBits.DeprecatedAnnotationResolved) == 0) {
++ TypeDeclaration typeDecl = this.scope.referenceContext;
++ boolean old = typeDecl.staticInitializerScope.insideTypeAnnotation;
++ try {
++ typeDecl.staticInitializerScope.insideTypeAnnotation = true;
++ ASTNode.resolveDeprecatedAnnotations(typeDecl.staticInitializerScope, typeDecl.annotations, this);
++ this.tagBits |= TagBits.DeprecatedAnnotationResolved;
++ } finally {
++ typeDecl.staticInitializerScope.insideTypeAnnotation = old;
++ }
++ if ((this.tagBits & TagBits.AnnotationDeprecated) != 0) {
++ this.modifiers |= ClassFileConstants.AccDeprecated;
++ }
++ }
+ }
+
+ // ensure the receiver knows its hierarchy & fields/methods so static imports can be resolved correctly
+ // see bug 230026
+ void initializeForStaticImports() {
+- if (this.scope == null) return; // already initialized
++ if (this.scope == null) return; // already initialized
+
+- if (this.superInterfaces == null)
+- this.scope.connectTypeHierarchy();
+- this.scope.buildFields();
+- this.scope.buildMethods();
++ if (this.superInterfaces == null)
++ this.scope.connectTypeHierarchy();
++ this.scope.buildFields();
++ this.scope.buildMethods();
+ }
+
+ /**
+@@ -1018,655 +1016,613 @@
+ */
+ public boolean isEquivalentTo(TypeBinding otherType) {
+
+- if (this == otherType) return true;
+- if (otherType == null) return false;
+- switch(otherType.kind()) {
+-
+- case Binding.WILDCARD_TYPE :
+- case Binding.INTERSECTION_TYPE:
+- return ((WildcardBinding) otherType).boundCheck(this);
+-
+- case Binding.PARAMETERIZED_TYPE :
+- if ((otherType.tagBits & TagBits.HasDirectWildcard) == 0 && (!this.isMemberType() || !otherType.isMemberType()))
+- return false; // should have been identical
+- ParameterizedTypeBinding otherParamType = (ParameterizedTypeBinding) otherType;
+- if (this != otherParamType.genericType())
+- return false;
+- if (!isStatic()) { // static member types do not compare their enclosing
+- ReferenceBinding enclosing = enclosingType();
+- if (enclosing != null) {
+- ReferenceBinding otherEnclosing = otherParamType.enclosingType();
+- if (otherEnclosing == null) return false;
+- if ((otherEnclosing.tagBits & TagBits.HasDirectWildcard) == 0) {
+- if (enclosing != otherEnclosing) return false;
+- } else {
+- if (!enclosing.isEquivalentTo(otherParamType.enclosingType())) return false;
+- }
+- }
+- }
+- int length = this.typeVariables == null ? 0 : this.typeVariables.length;
+- TypeBinding[] otherArguments = otherParamType.arguments;
+- int otherLength = otherArguments == null ? 0 : otherArguments.length;
+- if (otherLength != length)
+- return false;
+- for (int i = 0; i < length; i++)
+- if (!this.typeVariables[i].isTypeArgumentContainedBy(otherArguments[i]))
+- return false;
+- return true;
+-
+- case Binding.RAW_TYPE :
+- return otherType.erasure() == this;
+- }
+- return false;
++ if (this == otherType) return true;
++ if (otherType == null) return false;
++ switch(otherType.kind()) {
++
++ case Binding.WILDCARD_TYPE :
++ case Binding.INTERSECTION_TYPE:
++ return ((WildcardBinding) otherType).boundCheck(this);
++
++ case Binding.PARAMETERIZED_TYPE :
++ if ((otherType.tagBits & TagBits.HasDirectWildcard) == 0 && (!isMemberType() || !otherType.isMemberType()))
++ return false; // should have been identical
++ ParameterizedTypeBinding otherParamType = (ParameterizedTypeBinding) otherType;
++ if (this != otherParamType.genericType())
++ return false;
++ if (!isStatic()) { // static member types do not compare their enclosing
++ ReferenceBinding enclosing = enclosingType();
++ if (enclosing != null) {
++ ReferenceBinding otherEnclosing = otherParamType.enclosingType();
++ if (otherEnclosing == null) return false;
++ if ((otherEnclosing.tagBits & TagBits.HasDirectWildcard) == 0) {
++ if (enclosing != otherEnclosing) return false;
++ } else {
++ if (!enclosing.isEquivalentTo(otherParamType.enclosingType())) return false;
++ }
++ }
++ }
++ int length = this.typeVariables == null ? 0 : this.typeVariables.length;
++ TypeBinding[] otherArguments = otherParamType.arguments;
++ int otherLength = otherArguments == null ? 0 : otherArguments.length;
++ if (otherLength != length)
++ return false;
++ for (int i = 0; i < length; i++)
++ if (!this.typeVariables[i].isTypeArgumentContainedBy(otherArguments[i]))
++ return false;
++ return true;
++
++ case Binding.RAW_TYPE :
++ return otherType.erasure() == this;
++ }
++ return false;
+ }
+ public boolean isGenericType() {
+ return this.typeVariables != Binding.NO_TYPE_VARIABLES;
+ }
+-public ReferenceBinding[] memberTypes() {
+- return this.memberTypes;
++public boolean isHierarchyConnected() {
++ return (this.tagBits & TagBits.EndHierarchyCheck) != 0;
+ }
+-public FieldBinding getUpdatedFieldBinding(FieldBinding targetField, ReferenceBinding newDeclaringClass) {
+- if (this.synthetics == null)
+- this.synthetics = new HashMap[MAX_SYNTHETICS];
+- if (this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL] == null)
+- this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL] = new HashMap();
+-
+- Hashtable fieldMap = (Hashtable) this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL].get(targetField);
+- if (fieldMap == null) {
+- fieldMap = new Hashtable(5);
+- this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL].put(targetField, fieldMap);
+- }
+- FieldBinding updatedField = (FieldBinding) fieldMap.get(newDeclaringClass);
+- if (updatedField == null){
+- updatedField = new FieldBinding(targetField, newDeclaringClass);
+- fieldMap.put(newDeclaringClass, updatedField);
+- }
+- return updatedField;
+-}
+-public MethodBinding getUpdatedMethodBinding(MethodBinding targetMethod, ReferenceBinding newDeclaringClass) {
+- if (this.synthetics == null)
+- this.synthetics = new HashMap[MAX_SYNTHETICS];
+- if (this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL] == null)
+- this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL] = new HashMap();
+-
+- Hashtable methodMap = (Hashtable) this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL].get(targetMethod);
+- if (methodMap == null) {
+- methodMap = new Hashtable(5);
+- this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL].put(targetMethod, methodMap);
+- }
+- MethodBinding updatedMethod = (MethodBinding) methodMap.get(newDeclaringClass);
+- if (updatedMethod == null){
+- updatedMethod = new MethodBinding(targetMethod, newDeclaringClass);
+- methodMap.put(newDeclaringClass, updatedMethod);
+- }
+- return updatedMethod;
++public ReferenceBinding[] memberTypes() {
++ return this.memberTypes;
+ }
+ public boolean hasMemberTypes() {
+ return this.memberTypes.length > 0;
+ }
++
+ // NOTE: the return type, arg & exception types of each method of a source type are resolved when needed
+ public MethodBinding[] methods() {
+- if ((this.tagBits & TagBits.AreMethodsComplete) != 0)
+- return this.methods;
+-
+- // lazily sort methods
+- if ((this.tagBits & TagBits.AreMethodsSorted) == 0) {
+- int length = this.methods.length;
+- if (length > 1)
+- ReferenceBinding.sortMethods(this.methods, 0, length);
+- this.tagBits |= TagBits.AreMethodsSorted;
+- }
+-
+- int failed = 0;
+- MethodBinding[] resolvedMethods = this.methods;
+- try {
+- for (int i = 0, length = this.methods.length; i < length; i++) {
+- if (resolveTypesFor(this.methods[i]) == null) {
+- // do not alter original method array until resolution is over, due to reentrance (143259)
+- if (resolvedMethods == this.methods) {
+- System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);
+- }
+- resolvedMethods[i] = null; // unable to resolve parameters
+- failed++;
+- }
+- }
+-
+- // find & report collision cases
+- boolean complyTo15 = this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5;
+- for (int i = 0, length = this.methods.length; i < length; i++) {
+- MethodBinding method = resolvedMethods[i];
+- if (method == null)
+- continue;
+- char[] selector = method.selector;
+- AbstractMethodDeclaration methodDecl = null;
+- nextSibling: for (int j = i + 1; j < length; j++) {
+- MethodBinding method2 = resolvedMethods[j];
+- if (method2 == null)
+- continue nextSibling;
+- if (!CharOperation.equals(selector, method2.selector))
+- break nextSibling; // methods with same selector are contiguous
+-
+- if (complyTo15 && method.returnType != null && method2.returnType != null) {
+- // 8.4.2, for collision to be detected between m1 and m2:
+- // signature(m1) == signature(m2) i.e. same arity, same type parameter count, can be substituted
+- // signature(m1) == erasure(signature(m2)) or erasure(signature(m1)) == signature(m2)
+- TypeBinding[] params1 = method.parameters;
+- TypeBinding[] params2 = method2.parameters;
+- int pLength = params1.length;
+- if (pLength != params2.length)
+- continue nextSibling;
+-
+- TypeVariableBinding[] vars = method.typeVariables;
+- TypeVariableBinding[] vars2 = method2.typeVariables;
+- boolean equalTypeVars = vars == vars2;
+- MethodBinding subMethod = method2;
+- if (!equalTypeVars) {
+- MethodBinding temp = method.computeSubstitutedMethod(method2, this.scope.environment());
+- if (temp != null) {
+- equalTypeVars = true;
+- subMethod = temp;
+- }
+- }
+- boolean equalParams = method.areParametersEqual(subMethod);
+- if (equalParams && equalTypeVars) {
+- // duplicates regardless of return types
+- } else if (method.returnType.erasure() == subMethod.returnType.erasure() && (equalParams || method.areParameterErasuresEqual(method2))) {
+- // name clash for sure if not duplicates, report as duplicates
+- } else if (!equalTypeVars && vars != Binding.NO_TYPE_VARIABLES && vars2 != Binding.NO_TYPE_VARIABLES) {
+- // type variables are different so we can distinguish between methods
+- continue nextSibling;
+- } else if (pLength > 0) {
+- // check to see if the erasure of either method is equal to the other
+- int index = pLength;
+- for (; --index >= 0;) {
+- if (params1[index] != params2[index].erasure())
+- break;
+- if (params1[index] == params2[index]) {
+- TypeBinding type = params1[index].leafComponentType();
+- if (type instanceof SourceTypeBinding && type.typeVariables() != Binding.NO_TYPE_VARIABLES) {
+- index = pLength; // handle comparing identical source types like X<T>... its erasure is itself BUT we need to answer false
+- break;
+- }
+- }
+- }
+- if (index >= 0 && index < pLength) {
+- for (index = pLength; --index >= 0;)
+- if (params1[index].erasure() != params2[index])
+- break;
+- }
+- if (index >= 0)
+- continue nextSibling;
+- }
+- } else if (!method.areParametersEqual(method2)) { // prior to 1.5, parameter identity meant a collision case
+- continue nextSibling;
+- }
+- boolean isEnumSpecialMethod = isEnum() && (CharOperation.equals(selector,TypeConstants.VALUEOF) || CharOperation.equals(selector,TypeConstants.VALUES));
+- // report duplicate
+- if (methodDecl == null) {
+- methodDecl = method.sourceMethod(); // cannot be retrieved after binding is lost & may still be null if method is special
+- if (methodDecl != null && methodDecl.binding != null) { // ensure its a valid user defined method
+- if (isEnumSpecialMethod) {
+- this.scope.problemReporter().duplicateEnumSpecialMethod(this, methodDecl);
+- } else {
+- this.scope.problemReporter().duplicateMethodInType(this, methodDecl, method.areParametersEqual(method2));
+- }
+- methodDecl.binding = null;
+- // do not alter original method array until resolution is over, due to reentrance (143259)
+- if (resolvedMethods == this.methods) {
+- System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);
+- }
+- resolvedMethods[i] = null;
+- failed++;
+- }
+- }
+- AbstractMethodDeclaration method2Decl = method2.sourceMethod();
+- if (method2Decl != null && method2Decl.binding != null) { // ensure its a valid user defined method
+- if (isEnumSpecialMethod) {
+- this.scope.problemReporter().duplicateEnumSpecialMethod(this, method2Decl);
+- } else {
+- this.scope.problemReporter().duplicateMethodInType(this, method2Decl, method.areParametersEqual(method2));
+- }
+- method2Decl.binding = null;
+- // do not alter original method array until resolution is over, due to reentrance (143259)
+- if (resolvedMethods == this.methods) {
+- System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);
+- }
+- resolvedMethods[j] = null;
+- failed++;
+- }
+- }
+- if (method.returnType == null && methodDecl == null) { // forget method with invalid return type... was kept to detect possible collisions
+- methodDecl = method.sourceMethod();
+- if (methodDecl != null) {
+- methodDecl.binding = null;
+- }
+- // do not alter original method array until resolution is over, due to reentrance (143259)
+- if (resolvedMethods == this.methods) {
+- System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);
+- }
+- resolvedMethods[i] = null;
+- failed++;
+- }
+- }
+- } finally {
+- if (failed > 0) {
+- int newSize = resolvedMethods.length - failed;
+- if (newSize == 0) {
+- this.methods = Binding.NO_METHODS;
+- } else {
+- MethodBinding[] newMethods = new MethodBinding[newSize];
+- for (int i = 0, j = 0, length = resolvedMethods.length; i < length; i++)
+- if (resolvedMethods[i] != null)
+- newMethods[j++] = resolvedMethods[i];
+- this.methods = newMethods;
+- }
+- }
+-
+- // handle forward references to potential default abstract methods
+- addDefaultAbstractMethods();
+- this.tagBits |= TagBits.AreMethodsComplete;
+- }
+- return this.methods;
+-}
+-private FieldBinding resolveTypeFor(FieldBinding field) {
+- if ((field.modifiers & ExtraCompilerModifiers.AccUnresolved) == 0)
+- return field;
+-
+- if (this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) {
+- if ((field.getAnnotationTagBits() & TagBits.AnnotationDeprecated) != 0)
+- field.modifiers |= ClassFileConstants.AccDeprecated;
+- }
+- if (isViewedAsDeprecated() && !field.isDeprecated())
+- field.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
+- if (hasRestrictedAccess())
+- field.modifiers |= ExtraCompilerModifiers.AccRestrictedAccess;
+- FieldDeclaration[] fieldDecls = this.scope.referenceContext.fields;
+- for (int f = 0, length = fieldDecls.length; f < length; f++) {
+- if (fieldDecls[f].binding != field)
+- continue;
+-
+- MethodScope initializationScope = field.isStatic()
+- ? this.scope.referenceContext.staticInitializerScope
+- : this.scope.referenceContext.initializerScope;
+- FieldBinding previousField = initializationScope.initializedField;
+- try {
+- initializationScope.initializedField = field;
+- FieldDeclaration fieldDecl = fieldDecls[f];
+- TypeBinding fieldType =
+- fieldDecl.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT
+- ? initializationScope.environment().convertToRawType(this, false /*do not force conversion of enclosing types*/) // enum constant is implicitly of declaring enum type
+- : fieldDecl.type.resolveType(initializationScope, true /* check bounds*/);
+- field.type = fieldType;
+- field.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;
+- if (fieldType == null) {
+- fieldDecl.binding = null;
+- return null;
+- }
+- if (fieldType == TypeBinding.VOID) {
+- this.scope.problemReporter().variableTypeCannotBeVoid(fieldDecl);
+- fieldDecl.binding = null;
+- return null;
+- }
+- if (fieldType.isArrayType() && ((ArrayBinding) fieldType).leafComponentType == TypeBinding.VOID) {
+- this.scope.problemReporter().variableTypeCannotBeVoidArray(fieldDecl);
+- fieldDecl.binding = null;
+- return null;
+- }
+- if ((fieldType.tagBits & TagBits.HasMissingType) != 0) {
+- field.tagBits |= TagBits.HasMissingType;
+- }
+- TypeBinding leafType = fieldType.leafComponentType();
+- if (leafType instanceof ReferenceBinding && (((ReferenceBinding)leafType).modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0) {
+- field.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
+- }
+- } finally {
+- initializationScope.initializedField = previousField;
+- }
+- return field;
+- }
+- return null; // should never reach this point
++ if ((this.tagBits & TagBits.AreMethodsComplete) != 0)
++ return this.methods;
++
++ // lazily sort methods
++ if ((this.tagBits & TagBits.AreMethodsSorted) == 0) {
++ int length = this.methods.length;
++ if (length > 1)
++ ReferenceBinding.sortMethods(this.methods, 0, length);
++ this.tagBits |= TagBits.AreMethodsSorted;
++ }
++
++ int failed = 0;
++ MethodBinding[] resolvedMethods = this.methods;
++ try {
++ for (int i = 0, length = this.methods.length; i < length; i++) {
++ if (resolveTypesFor(this.methods[i]) == null) {
++ // do not alter original method array until resolution is over, due to reentrance (143259)
++ if (resolvedMethods == this.methods) {
++ System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);
++ }
++ resolvedMethods[i] = null; // unable to resolve parameters
++ failed++;
++ }
++ }
++
++ // find & report collision cases
++ boolean complyTo15 = this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5;
++ boolean complyTo17 = this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_7;
++ for (int i = 0, length = this.methods.length; i < length; i++) {
++ MethodBinding method = resolvedMethods[i];
++ if (method == null)
++ continue;
++ char[] selector = method.selector;
++ AbstractMethodDeclaration methodDecl = null;
++ nextSibling: for (int j = i + 1; j < length; j++) {
++ MethodBinding method2 = resolvedMethods[j];
++ if (method2 == null)
++ continue nextSibling;
++ if (!CharOperation.equals(selector, method2.selector))
++ break nextSibling; // methods with same selector are contiguous
++
++ if (complyTo15 && method.returnType != null && method2.returnType != null) {
++ // 8.4.2, for collision to be detected between m1 and m2:
++ // signature(m1) == signature(m2) i.e. same arity, same type parameter count, can be substituted
++ // signature(m1) == erasure(signature(m2)) or erasure(signature(m1)) == signature(m2)
++ TypeBinding[] params1 = method.parameters;
++ TypeBinding[] params2 = method2.parameters;
++ int pLength = params1.length;
++ if (pLength != params2.length)
++ continue nextSibling;
++
++ TypeVariableBinding[] vars = method.typeVariables;
++ TypeVariableBinding[] vars2 = method2.typeVariables;
++ boolean equalTypeVars = vars == vars2;
++ MethodBinding subMethod = method2;
++ if (!equalTypeVars) {
++ MethodBinding temp = method.computeSubstitutedMethod(method2, this.scope.environment());
++ if (temp != null) {
++ equalTypeVars = true;
++ subMethod = temp;
++ }
++ }
++ boolean equalParams = method.areParametersEqual(subMethod);
++ if (equalParams && equalTypeVars) {
++ // duplicates regardless of return types
++ } else if ((complyTo17 || method.returnType.erasure() == subMethod.returnType.erasure())
++ && (equalParams || method.areParameterErasuresEqual(method2))) {
++ // with fix for http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
++ // we now ignore return types when detecting duplicates, just as we did before 1.5
++ // name clash for sure if not duplicates, report as duplicates
++ // FYI for now we will only make this change when compliance is set to 1.7 or higher
++ } else if (!equalTypeVars && vars != Binding.NO_TYPE_VARIABLES && vars2 != Binding.NO_TYPE_VARIABLES) {
++ // type variables are different so we can distinguish between methods
++ continue nextSibling;
++ } else if (pLength > 0) {
++ // check to see if the erasure of either method is equal to the other
++ int index = pLength;
++ for (; --index >= 0;) {
++ if (params1[index] != params2[index].erasure())
++ break;
++ if (params1[index] == params2[index]) {
++ TypeBinding type = params1[index].leafComponentType();
++ if (type instanceof SourceTypeBinding && type.typeVariables() != Binding.NO_TYPE_VARIABLES) {
++ index = pLength; // handle comparing identical source types like X<T>... its erasure is itself BUT we need to answer false
++ break;
++ }
++ }
++ }
++ if (index >= 0 && index < pLength) {
++ for (index = pLength; --index >= 0;)
++ if (params1[index].erasure() != params2[index])
++ break;
++ }
++ if (index >= 0)
++ continue nextSibling;
++ }
++ } else if (!method.areParametersEqual(method2)) { // prior to 1.5, parameter identity meant a collision case
++ continue nextSibling;
++ }
++ boolean isEnumSpecialMethod = isEnum() && (CharOperation.equals(selector,TypeConstants.VALUEOF) || CharOperation.equals(selector,TypeConstants.VALUES));
++ // report duplicate
++ boolean removeMethod2 = true;
++ if (methodDecl == null) {
++ methodDecl = method.sourceMethod(); // cannot be retrieved after binding is lost & may still be null if method is special
++ if (methodDecl != null && methodDecl.binding != null) { // ensure its a valid user defined method
++ boolean removeMethod = method.returnType == null && method2.returnType != null;
++ if (isEnumSpecialMethod) {
++ this.scope.problemReporter().duplicateEnumSpecialMethod(this, methodDecl);
++ // remove user defined methods & keep the synthetic
++ removeMethod = true;
++ } else {
++ this.scope.problemReporter().duplicateMethodInType(this, methodDecl, method.areParametersEqual(method2));
++ }
++ if (removeMethod) {
++ removeMethod2 = false;
++ methodDecl.binding = null;
++ // do not alter original method array until resolution is over, due to reentrance (143259)
++ if (resolvedMethods == this.methods)
++ System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);
++ resolvedMethods[i] = null;
++ failed++;
++ }
++ }
++ }
++ AbstractMethodDeclaration method2Decl = method2.sourceMethod();
++ if (method2Decl != null && method2Decl.binding != null) { // ensure its a valid user defined method
++ if (isEnumSpecialMethod) {
++ this.scope.problemReporter().duplicateEnumSpecialMethod(this, method2Decl);
++ removeMethod2 = true;
++ } else {
++ this.scope.problemReporter().duplicateMethodInType(this, method2Decl, method.areParametersEqual(method2));
++ }
++ if (removeMethod2) {
++ method2Decl.binding = null;
++ // do not alter original method array until resolution is over, due to reentrance (143259)
++ if (resolvedMethods == this.methods)
++ System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);
++ resolvedMethods[j] = null;
++ failed++;
++ }
++ }
++ }
++ if (method.returnType == null && resolvedMethods[i] != null) { // forget method with invalid return type... was kept to detect possible collisions
++ methodDecl = method.sourceMethod();
++ if (methodDecl != null)
++ methodDecl.binding = null;
++ // do not alter original method array until resolution is over, due to reentrance (143259)
++ if (resolvedMethods == this.methods)
++ System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);
++ resolvedMethods[i] = null;
++ failed++;
++ }
++ }
++ } finally {
++ if (failed > 0) {
++ int newSize = resolvedMethods.length - failed;
++ if (newSize == 0) {
++ this.methods = Binding.NO_METHODS;
++ } else {
++ MethodBinding[] newMethods = new MethodBinding[newSize];
++ for (int i = 0, j = 0, length = resolvedMethods.length; i < length; i++)
++ if (resolvedMethods[i] != null)
++ newMethods[j++] = resolvedMethods[i];
++ this.methods = newMethods;
++ }
++ }
++
++ // handle forward references to potential default abstract methods
++ addDefaultAbstractMethods();
++ this.tagBits |= TagBits.AreMethodsComplete;
++ }
++ return this.methods;
++}
++public FieldBinding resolveTypeFor(FieldBinding field) {
++ if ((field.modifiers & ExtraCompilerModifiers.AccUnresolved) == 0)
++ return field;
++
++ if (this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) {
++ if ((field.getAnnotationTagBits() & TagBits.AnnotationDeprecated) != 0)
++ field.modifiers |= ClassFileConstants.AccDeprecated;
++ }
++ if (isViewedAsDeprecated() && !field.isDeprecated())
++ field.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
++ if (hasRestrictedAccess())
++ field.modifiers |= ExtraCompilerModifiers.AccRestrictedAccess;
++ FieldDeclaration[] fieldDecls = this.scope.referenceContext.fields;
++ for (int f = 0, length = fieldDecls.length; f < length; f++) {
++ if (fieldDecls[f].binding != field)
++ continue;
++
++ MethodScope initializationScope = field.isStatic()
++ ? this.scope.referenceContext.staticInitializerScope
++ : this.scope.referenceContext.initializerScope;
++ FieldBinding previousField = initializationScope.initializedField;
++ try {
++ initializationScope.initializedField = field;
++ FieldDeclaration fieldDecl = fieldDecls[f];
++ TypeBinding fieldType =
++ fieldDecl.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT
++ ? initializationScope.environment().convertToRawType(this, false /*do not force conversion of enclosing types*/) // enum constant is implicitly of declaring enum type
++ : fieldDecl.type.resolveType(initializationScope, true /* check bounds*/);
++ field.type = fieldType;
++ field.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;
++ if (fieldType == null) {
++ fieldDecl.binding = null;
++ return null;
++ }
++ if (fieldType == TypeBinding.VOID) {
++ this.scope.problemReporter().variableTypeCannotBeVoid(fieldDecl);
++ fieldDecl.binding = null;
++ return null;
++ }
++ if (fieldType.isArrayType() && ((ArrayBinding) fieldType).leafComponentType == TypeBinding.VOID) {
++ this.scope.problemReporter().variableTypeCannotBeVoidArray(fieldDecl);
++ fieldDecl.binding = null;
++ return null;
++ }
++ if ((fieldType.tagBits & TagBits.HasMissingType) != 0) {
++ field.tagBits |= TagBits.HasMissingType;
++ }
++ TypeBinding leafType = fieldType.leafComponentType();
++ if (leafType instanceof ReferenceBinding && (((ReferenceBinding)leafType).modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0) {
++ field.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
++ }
++ } finally {
++ initializationScope.initializedField = previousField;
++ }
++ return field;
++ }
++ return null; // should never reach this point
+ }
+ public MethodBinding resolveTypesFor(MethodBinding method) {
+- if ((method.modifiers & ExtraCompilerModifiers.AccUnresolved) == 0)
+- return method;
++ if ((method.modifiers & ExtraCompilerModifiers.AccUnresolved) == 0)
++ return method;
+
+- if (this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) {
+- if ((method.getAnnotationTagBits() & TagBits.AnnotationDeprecated) != 0)
+- method.modifiers |= ClassFileConstants.AccDeprecated;
+- }
+- if (isViewedAsDeprecated() && !method.isDeprecated())
+- method.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
+- if (hasRestrictedAccess())
+- method.modifiers |= ExtraCompilerModifiers.AccRestrictedAccess;
+-
+- AbstractMethodDeclaration methodDecl = method.sourceMethod();
+- if (methodDecl == null) return null; // method could not be resolved in previous iteration
+-
+- TypeParameter[] typeParameters = methodDecl.typeParameters();
+- if (typeParameters != null) {
+- methodDecl.scope.connectTypeVariables(typeParameters, true);
+- // Perform deferred bound checks for type variables (only done after type variable hierarchy is connected)
+- for (int i = 0, paramLength = typeParameters.length; i < paramLength; i++)
+- typeParameters[i].checkBounds(methodDecl.scope);
+- }
+- TypeReference[] exceptionTypes = methodDecl.thrownExceptions;
+- if (exceptionTypes != null) {
+- int size = exceptionTypes.length;
+- method.thrownExceptions = new ReferenceBinding[size];
+- int count = 0;
+- ReferenceBinding resolvedExceptionType;
+- for (int i = 0; i < size; i++) {
+- resolvedExceptionType = (ReferenceBinding) exceptionTypes[i].resolveType(methodDecl.scope, true /* check bounds*/);
+- if (resolvedExceptionType == null)
+- continue;
+- if (resolvedExceptionType.isBoundParameterizedType()) {
+- methodDecl.scope.problemReporter().invalidParameterizedExceptionType(resolvedExceptionType, exceptionTypes[i]);
+- continue;
+- }
+- if (resolvedExceptionType.findSuperTypeOriginatingFrom(TypeIds.T_JavaLangThrowable, true) == null) {
+- if (resolvedExceptionType.isValidBinding()) {
+- methodDecl.scope.problemReporter().cannotThrowType(exceptionTypes[i], resolvedExceptionType);
+- continue;
+- }
+- }
+- if ((resolvedExceptionType.tagBits & TagBits.HasMissingType) != 0) {
+- method.tagBits |= TagBits.HasMissingType;
+- }
+- method.modifiers |= (resolvedExceptionType.modifiers & ExtraCompilerModifiers.AccGenericSignature);
+- method.thrownExceptions[count++] = resolvedExceptionType;
+- }
+- if (count < size)
+- System.arraycopy(method.thrownExceptions, 0, method.thrownExceptions = new ReferenceBinding[count], 0, count);
+- }
+-
+- boolean foundArgProblem = false;
+- Argument[] arguments = methodDecl.arguments;
+- if (arguments != null) {
+- int size = arguments.length;
+- method.parameters = Binding.NO_PARAMETERS;
+- TypeBinding[] newParameters = new TypeBinding[size];
+- for (int i = 0; i < size; i++) {
+- Argument arg = arguments[i];
+- if (arg.annotations != null) {
+- method.tagBits |= TagBits.HasParameterAnnotations;
+- }
+- TypeBinding parameterType = arg.type.resolveType(methodDecl.scope, true /* check bounds*/);
+- if (parameterType == null) {
+- foundArgProblem = true;
+- } else if (parameterType == TypeBinding.VOID) {
+- methodDecl.scope.problemReporter().argumentTypeCannotBeVoid(this, methodDecl, arg);
+- foundArgProblem = true;
+- } else {
+- if ((parameterType.tagBits & TagBits.HasMissingType) != 0) {
+- method.tagBits |= TagBits.HasMissingType;
+- }
+- TypeBinding leafType = parameterType.leafComponentType();
+- if (leafType instanceof ReferenceBinding && (((ReferenceBinding) leafType).modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0)
+- method.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
+- newParameters[i] = parameterType;
+- arg.binding = new LocalVariableBinding(arg, parameterType, arg.modifiers, true);
+- }
+- }
+- // only assign parameters if no problems are found
+- if (!foundArgProblem) {
+- method.parameters = newParameters;
+- }
+- }
+-
+- boolean foundReturnTypeProblem = false;
+- if (!method.isConstructor()) {
+- TypeReference returnType = methodDecl instanceof MethodDeclaration
+- ? ((MethodDeclaration) methodDecl).returnType
+- : null;
+- if (returnType == null) {
+- methodDecl.scope.problemReporter().missingReturnType(methodDecl);
+- method.returnType = null;
+- foundReturnTypeProblem = true;
+- } else {
+- TypeBinding methodType = returnType.resolveType(methodDecl.scope, true /* check bounds*/);
+- if (methodType == null) {
+- foundReturnTypeProblem = true;
+- } else if (methodType.isArrayType() && ((ArrayBinding) methodType).leafComponentType == TypeBinding.VOID) {
+- methodDecl.scope.problemReporter().returnTypeCannotBeVoidArray((MethodDeclaration) methodDecl);
+- foundReturnTypeProblem = true;
+- } else {
+- if ((methodType.tagBits & TagBits.HasMissingType) != 0) {
+- method.tagBits |= TagBits.HasMissingType;
+- }
+- method.returnType = methodType;
+- TypeBinding leafType = methodType.leafComponentType();
+- if (leafType instanceof ReferenceBinding && (((ReferenceBinding) leafType).modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0)
+- method.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
+- }
+- }
+- }
+- if (foundArgProblem) {
+- methodDecl.binding = null;
+- method.parameters = Binding.NO_PARAMETERS; // see 107004
+- // nullify type parameter bindings as well as they have a backpointer to the method binding
+- // (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=81134)
+- if (typeParameters != null)
+- for (int i = 0, length = typeParameters.length; i < length; i++)
+- typeParameters[i].binding = null;
+- return null;
+- }
+- if (foundReturnTypeProblem)
+- return method; // but its still unresolved with a null return type & is still connected to its method declaration
++ if (this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) {
++ if ((method.getAnnotationTagBits() & TagBits.AnnotationDeprecated) != 0)
++ method.modifiers |= ClassFileConstants.AccDeprecated;
++ }
++ if (isViewedAsDeprecated() && !method.isDeprecated())
++ method.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
++ if (hasRestrictedAccess())
++ method.modifiers |= ExtraCompilerModifiers.AccRestrictedAccess;
++
++ AbstractMethodDeclaration methodDecl = method.sourceMethod();
++ if (methodDecl == null) return null; // method could not be resolved in previous iteration
++
++ TypeParameter[] typeParameters = methodDecl.typeParameters();
++ if (typeParameters != null) {
++ methodDecl.scope.connectTypeVariables(typeParameters, true);
++ // Perform deferred bound checks for type variables (only done after type variable hierarchy is connected)
++ for (int i = 0, paramLength = typeParameters.length; i < paramLength; i++)
++ typeParameters[i].checkBounds(methodDecl.scope);
++ }
++ TypeReference[] exceptionTypes = methodDecl.thrownExceptions;
++ if (exceptionTypes != null) {
++ int size = exceptionTypes.length;
++ method.thrownExceptions = new ReferenceBinding[size];
++ int count = 0;
++ ReferenceBinding resolvedExceptionType;
++ for (int i = 0; i < size; i++) {
++ resolvedExceptionType = (ReferenceBinding) exceptionTypes[i].resolveType(methodDecl.scope, true /* check bounds*/);
++ if (resolvedExceptionType == null)
++ continue;
++ if (resolvedExceptionType.isBoundParameterizedType()) {
++ methodDecl.scope.problemReporter().invalidParameterizedExceptionType(resolvedExceptionType, exceptionTypes[i]);
++ continue;
++ }
++ if (resolvedExceptionType.findSuperTypeOriginatingFrom(TypeIds.T_JavaLangThrowable, true) == null) {
++ if (resolvedExceptionType.isValidBinding()) {
++ methodDecl.scope.problemReporter().cannotThrowType(exceptionTypes[i], resolvedExceptionType);
++ continue;
++ }
++ }
++ if ((resolvedExceptionType.tagBits & TagBits.HasMissingType) != 0) {
++ method.tagBits |= TagBits.HasMissingType;
++ }
++ method.modifiers |= (resolvedExceptionType.modifiers & ExtraCompilerModifiers.AccGenericSignature);
++ method.thrownExceptions[count++] = resolvedExceptionType;
++ }
++ if (count < size)
++ System.arraycopy(method.thrownExceptions, 0, method.thrownExceptions = new ReferenceBinding[count], 0, count);
++ }
++
++ boolean foundArgProblem = false;
++ Argument[] arguments = methodDecl.arguments;
++ if (arguments != null) {
++ int size = arguments.length;
++ method.parameters = Binding.NO_PARAMETERS;
++ TypeBinding[] newParameters = new TypeBinding[size];
++ for (int i = 0; i < size; i++) {
++ Argument arg = arguments[i];
++ if (arg.annotations != null) {
++ method.tagBits |= TagBits.HasParameterAnnotations;
++ }
++ TypeBinding parameterType = arg.type.resolveType(methodDecl.scope, true /* check bounds*/);
++ if (parameterType == null) {
++ foundArgProblem = true;
++ } else if (parameterType == TypeBinding.VOID) {
++ methodDecl.scope.problemReporter().argumentTypeCannotBeVoid(this, methodDecl, arg);
++ foundArgProblem = true;
++ } else {
++ if ((parameterType.tagBits & TagBits.HasMissingType) != 0) {
++ method.tagBits |= TagBits.HasMissingType;
++ }
++ TypeBinding leafType = parameterType.leafComponentType();
++ if (leafType instanceof ReferenceBinding && (((ReferenceBinding) leafType).modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0)
++ method.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
++ newParameters[i] = parameterType;
++ arg.binding = new LocalVariableBinding(arg, parameterType, arg.modifiers, true);
++ }
++ }
++ // only assign parameters if no problems are found
++ if (!foundArgProblem) {
++ method.parameters = newParameters;
++ }
++ }
++
++ boolean foundReturnTypeProblem = false;
++ if (!method.isConstructor()) {
++ TypeReference returnType = methodDecl instanceof MethodDeclaration
++ ? ((MethodDeclaration) methodDecl).returnType
++ : null;
++ if (returnType == null) {
++ methodDecl.scope.problemReporter().missingReturnType(methodDecl);
++ method.returnType = null;
++ foundReturnTypeProblem = true;
++ } else {
++ TypeBinding methodType = returnType.resolveType(methodDecl.scope, true /* check bounds*/);
++ if (methodType == null) {
++ foundReturnTypeProblem = true;
++ } else if (methodType.isArrayType() && ((ArrayBinding) methodType).leafComponentType == TypeBinding.VOID) {
++ methodDecl.scope.problemReporter().returnTypeCannotBeVoidArray((MethodDeclaration) methodDecl);
++ foundReturnTypeProblem = true;
++ } else {
++ if ((methodType.tagBits & TagBits.HasMissingType) != 0) {
++ method.tagBits |= TagBits.HasMissingType;
++ }
++ method.returnType = methodType;
++ TypeBinding leafType = methodType.leafComponentType();
++ if (leafType instanceof ReferenceBinding && (((ReferenceBinding) leafType).modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0)
++ method.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
++ }
++ }
++ }
++ if (foundArgProblem) {
++ methodDecl.binding = null;
++ method.parameters = Binding.NO_PARAMETERS; // see 107004
++ // nullify type parameter bindings as well as they have a backpointer to the method binding
++ // (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=81134)
++ if (typeParameters != null)
++ for (int i = 0, length = typeParameters.length; i < length; i++)
++ typeParameters[i].binding = null;
++ return null;
++ }
++ if (foundReturnTypeProblem)
++ return method; // but its still unresolved with a null return type & is still connected to its method declaration
+
+- method.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;
+- return method;
++ method.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;
++ return method;
+ }
+ public AnnotationHolder retrieveAnnotationHolder(Binding binding, boolean forceInitialization) {
+- if (forceInitialization)
+- binding.getAnnotationTagBits(); // ensure annotations are up to date
+- return super.retrieveAnnotationHolder(binding, false);
++ if (forceInitialization)
++ binding.getAnnotationTagBits(); // ensure annotations are up to date
++ return super.retrieveAnnotationHolder(binding, false);
+ }
+ public void setFields(FieldBinding[] fields) {
+- this.fields = fields;
++ this.fields = fields;
+ }
+ public void setMethods(MethodBinding[] methods) {
+- this.methods = methods;
++ this.methods = methods;
+ }
+ public final int sourceEnd() {
+- return this.scope.referenceContext.sourceEnd;
++ return this.scope.referenceContext.sourceEnd;
+ }
+ public final int sourceStart() {
+- return this.scope.referenceContext.sourceStart;
++ return this.scope.referenceContext.sourceStart;
+ }
+ SimpleLookupTable storedAnnotations(boolean forceInitialize) {
+- if (forceInitialize && this.storedAnnotations == null && this.scope != null) { // scope null when no annotation cached, and type got processed fully (159631)
+- this.scope.referenceCompilationUnit().compilationResult.hasAnnotations = true;
+- if (!this.scope.environment().globalOptions.storeAnnotations)
+- return null; // not supported during this compile
+- this.storedAnnotations = new SimpleLookupTable(3);
+- }
+- return this.storedAnnotations;
++ if (forceInitialize && this.storedAnnotations == null && this.scope != null) { // scope null when no annotation cached, and type got processed fully (159631)
++ this.scope.referenceCompilationUnit().compilationResult.hasAnnotations = true;
++ if (!this.scope.environment().globalOptions.storeAnnotations)
++ return null; // not supported during this compile
++ this.storedAnnotations = new SimpleLookupTable(3);
++ }
++ return this.storedAnnotations;
+ }
+ public ReferenceBinding superclass() {
+- return this.superclass;
++ return this.superclass;
+ }
+ public ReferenceBinding[] superInterfaces() {
+- return this.superInterfaces;
++ return this.superInterfaces;
+ }
+-// TODO (philippe) could be a performance issue since some senders are building the list just to count them
+-public SyntheticMethodBinding[] syntheticMethods() {
+-
+- if (this.synthetics == null || this.synthetics[SourceTypeBinding.METHOD_EMUL] == null || this.synthetics[SourceTypeBinding.METHOD_EMUL].size() == 0) return null;
+
+- // difficult to compute size up front because of the embedded arrays so assume there is only 1
+- int index = 0;
+- SyntheticMethodBinding[] bindings = new SyntheticMethodBinding[1];
+- Iterator fieldsOrMethods = this.synthetics[SourceTypeBinding.METHOD_EMUL].keySet().iterator();
+- while (fieldsOrMethods.hasNext()) {
+-
+- Object fieldOrMethod = fieldsOrMethods.next();
+-
+- if (fieldOrMethod instanceof MethodBinding) {
+-
+- SyntheticMethodBinding[] methodAccessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(fieldOrMethod);
+- int numberOfAccessors = 0;
+- if (methodAccessors[0] != null) numberOfAccessors++;
+- if (methodAccessors[1] != null) numberOfAccessors++;
+- if (index + numberOfAccessors > bindings.length)
+- System.arraycopy(bindings, 0, (bindings = new SyntheticMethodBinding[index + numberOfAccessors]), 0, index);
+- if (methodAccessors[0] != null)
+- bindings[index++] = methodAccessors[0]; // super access
+- if (methodAccessors[1] != null)
+- bindings[index++] = methodAccessors[1]; // normal access or bridge
+-
+- } else {
+-
+- SyntheticMethodBinding[] fieldAccessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(fieldOrMethod);
+- int numberOfAccessors = 0;
+- if (fieldAccessors[0] != null) numberOfAccessors++;
+- if (fieldAccessors[1] != null) numberOfAccessors++;
+- if (index + numberOfAccessors > bindings.length)
+- System.arraycopy(bindings, 0, (bindings = new SyntheticMethodBinding[index + numberOfAccessors]), 0, index);
+- if (fieldAccessors[0] != null)
+- bindings[index++] = fieldAccessors[0]; // read access
+- if (fieldAccessors[1] != null)
+- bindings[index++] = fieldAccessors[1]; // write access
+- }
+- }
+-
+- // sort them in according to their own indexes
+- int length;
+- SyntheticMethodBinding[] sortedBindings = new SyntheticMethodBinding[length = bindings.length];
+- for (int i = 0; i < length; i++){
+- SyntheticMethodBinding binding = bindings[i];
+- sortedBindings[binding.index] = binding;
+- }
+- return sortedBindings;
++public SyntheticMethodBinding[] syntheticMethods() {
++ if (this.synthetics == null
++ || this.synthetics[SourceTypeBinding.METHOD_EMUL] == null
++ || this.synthetics[SourceTypeBinding.METHOD_EMUL].size() == 0) {
++ return null;
++ }
++ // difficult to compute size up front because of the embedded arrays so assume there is only 1
++ int index = 0;
++ SyntheticMethodBinding[] bindings = new SyntheticMethodBinding[1];
++ Iterator methodArrayIterator = this.synthetics[SourceTypeBinding.METHOD_EMUL].values().iterator();
++ while (methodArrayIterator.hasNext()) {
++ SyntheticMethodBinding[] methodAccessors = (SyntheticMethodBinding[]) methodArrayIterator.next();
++ for (int i = 0, max = methodAccessors.length; i < max; i++) {
++ if (methodAccessors[i] != null) {
++ if (index+1 > bindings.length) {
++ System.arraycopy(bindings, 0, (bindings = new SyntheticMethodBinding[index + 1]), 0, index);
++ }
++ bindings[index++] = methodAccessors[i];
++ }
++ }
++ }
++ // sort them in according to their own indexes
++ int length;
++ SyntheticMethodBinding[] sortedBindings = new SyntheticMethodBinding[length = bindings.length];
++ for (int i = 0; i < length; i++){
++ SyntheticMethodBinding binding = bindings[i];
++ sortedBindings[binding.index] = binding;
++ }
++ return sortedBindings;
+ }
+ /**
+ * Answer the collection of synthetic fields to append into the classfile
+ */
+ public FieldBinding[] syntheticFields() {
+-
+- if (this.synthetics == null) return null;
+-
+- int fieldSize = this.synthetics[SourceTypeBinding.FIELD_EMUL] == null ? 0 : this.synthetics[SourceTypeBinding.FIELD_EMUL].size();
+- int literalSize = this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL] == null ? 0 :this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].size();
+- int totalSize = fieldSize + literalSize;
+- if (totalSize == 0) return null;
+- FieldBinding[] bindings = new FieldBinding[totalSize];
+-
+- // add innerclass synthetics
+- if (this.synthetics[SourceTypeBinding.FIELD_EMUL] != null){
+- Iterator elements = this.synthetics[SourceTypeBinding.FIELD_EMUL].values().iterator();
+- for (int i = 0; i < fieldSize; i++) {
+- SyntheticFieldBinding synthBinding = (SyntheticFieldBinding) elements.next();
+- bindings[synthBinding.index] = synthBinding;
+- }
+- }
+- // add class literal synthetics
+- if (this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL] != null){
+- Iterator elements = this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].values().iterator();
+- for (int i = 0; i < literalSize; i++) {
+- SyntheticFieldBinding synthBinding = (SyntheticFieldBinding) elements.next();
+- bindings[fieldSize+synthBinding.index] = synthBinding;
+- }
+- }
+- return bindings;
++ if (this.synthetics == null) return null;
++ int fieldSize = this.synthetics[SourceTypeBinding.FIELD_EMUL] == null ? 0 : this.synthetics[SourceTypeBinding.FIELD_EMUL].size();
++ int literalSize = this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL] == null ? 0 :this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].size();
++ int totalSize = fieldSize + literalSize;
++ if (totalSize == 0) return null;
++ FieldBinding[] bindings = new FieldBinding[totalSize];
++
++ // add innerclass synthetics
++ if (this.synthetics[SourceTypeBinding.FIELD_EMUL] != null){
++ Iterator elements = this.synthetics[SourceTypeBinding.FIELD_EMUL].values().iterator();
++ for (int i = 0; i < fieldSize; i++) {
++ SyntheticFieldBinding synthBinding = (SyntheticFieldBinding) elements.next();
++ bindings[synthBinding.index] = synthBinding;
++ }
++ }
++ // add class literal synthetics
++ if (this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL] != null){
++ Iterator elements = this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].values().iterator();
++ for (int i = 0; i < literalSize; i++) {
++ SyntheticFieldBinding synthBinding = (SyntheticFieldBinding) elements.next();
++ bindings[fieldSize+synthBinding.index] = synthBinding;
++ }
++ }
++ return bindings;
+ }
+ public String toString() {
+ StringBuffer buffer = new StringBuffer(30);
+ buffer.append("(id="); //$NON-NLS-1$
+- if (this.id == TypeIds.NoId)
++ if (this.id == TypeIds.NoId)
+ buffer.append("NoId"); //$NON-NLS-1$
+- else
++ else
+ buffer.append(this.id);
+ buffer.append(")\n"); //$NON-NLS-1$
+- if (isDeprecated()) buffer.append("deprecated "); //$NON-NLS-1$
+- if (isPublic()) buffer.append("public "); //$NON-NLS-1$
+- if (isProtected()) buffer.append("protected "); //$NON-NLS-1$
+- if (isPrivate()) buffer.append("private "); //$NON-NLS-1$
+- if (isAbstract() && isClass()) buffer.append("abstract "); //$NON-NLS-1$
+- if (isStatic() && isNestedType()) buffer.append("static "); //$NON-NLS-1$
+- if (isFinal()) buffer.append("final "); //$NON-NLS-1$
+-
+- if (isEnum()) buffer.append("enum "); //$NON-NLS-1$
+- else if (isAnnotationType()) buffer.append("@interface "); //$NON-NLS-1$
+- else if (isClass()) buffer.append("class "); //$NON-NLS-1$
+- else buffer.append("interface "); //$NON-NLS-1$
+- buffer.append((this.compoundName != null) ? CharOperation.toString(this.compoundName) : "UNNAMED TYPE"); //$NON-NLS-1$
+-
+- if (this.typeVariables == null) {
+- buffer.append("<NULL TYPE VARIABLES>"); //$NON-NLS-1$
+- } else if (this.typeVariables != Binding.NO_TYPE_VARIABLES) {
+- buffer.append("<"); //$NON-NLS-1$
+- for (int i = 0, length = this.typeVariables.length; i < length; i++) {
+- if (i > 0) buffer.append(", "); //$NON-NLS-1$
+- if (this.typeVariables[i] == null) {
+- buffer.append("NULL TYPE VARIABLE"); //$NON-NLS-1$
+- continue;
+- }
+- char[] varChars = this.typeVariables[i].toString().toCharArray();
+- buffer.append(varChars, 1, varChars.length - 2);
+- }
+- buffer.append(">"); //$NON-NLS-1$
+- }
+- buffer.append("\n\textends "); //$NON-NLS-1$
+- buffer.append((this.superclass != null) ? this.superclass.debugName() : "NULL TYPE"); //$NON-NLS-1$
+-
+- if (this.superInterfaces != null) {
+- if (this.superInterfaces != Binding.NO_SUPERINTERFACES) {
+- buffer.append("\n\timplements : "); //$NON-NLS-1$
+- for (int i = 0, length = this.superInterfaces.length; i < length; i++) {
+- if (i > 0)
+- buffer.append(", "); //$NON-NLS-1$
+- buffer.append((this.superInterfaces[i] != null) ? this.superInterfaces[i].debugName() : "NULL TYPE"); //$NON-NLS-1$
+- }
+- }
+- } else {
+- buffer.append("NULL SUPERINTERFACES"); //$NON-NLS-1$
+- }
+-
+- if (enclosingType() != null) {
+- buffer.append("\n\tenclosing type : "); //$NON-NLS-1$
+- buffer.append(enclosingType().debugName());
+- }
+-
+- if (this.fields != null) {
+- if (this.fields != Binding.NO_FIELDS) {
+- buffer.append("\n/* fields */"); //$NON-NLS-1$
+- for (int i = 0, length = this.fields.length; i < length; i++)
+- buffer.append('\n').append((this.fields[i] != null) ? this.fields[i].toString() : "NULL FIELD"); //$NON-NLS-1$
+- }
+- } else {
+- buffer.append("NULL FIELDS"); //$NON-NLS-1$
+- }
+-
+- if (this.methods != null) {
+- if (this.methods != Binding.NO_METHODS) {
+- buffer.append("\n/* methods */"); //$NON-NLS-1$
+- for (int i = 0, length = this.methods.length; i < length; i++)
+- buffer.append('\n').append((this.methods[i] != null) ? this.methods[i].toString() : "NULL METHOD"); //$NON-NLS-1$
+- }
+- } else {
+- buffer.append("NULL METHODS"); //$NON-NLS-1$
+- }
+-
+- if (this.memberTypes != null) {
+- if (this.memberTypes != Binding.NO_MEMBER_TYPES) {
+- buffer.append("\n/* members */"); //$NON-NLS-1$
+- for (int i = 0, length = this.memberTypes.length; i < length; i++)
+- buffer.append('\n').append((this.memberTypes[i] != null) ? this.memberTypes[i].toString() : "NULL TYPE"); //$NON-NLS-1$
+- }
+- } else {
+- buffer.append("NULL MEMBER TYPES"); //$NON-NLS-1$
+- }
++ if (isDeprecated()) buffer.append("deprecated "); //$NON-NLS-1$
++ if (isPublic()) buffer.append("public "); //$NON-NLS-1$
++ if (isProtected()) buffer.append("protected "); //$NON-NLS-1$
++ if (isPrivate()) buffer.append("private "); //$NON-NLS-1$
++ if (isAbstract() && isClass()) buffer.append("abstract "); //$NON-NLS-1$
++ if (isStatic() && isNestedType()) buffer.append("static "); //$NON-NLS-1$
++ if (isFinal()) buffer.append("final "); //$NON-NLS-1$
++
++ if (isEnum()) buffer.append("enum "); //$NON-NLS-1$
++ else if (isAnnotationType()) buffer.append("@interface "); //$NON-NLS-1$
++ else if (isClass()) buffer.append("class "); //$NON-NLS-1$
++ else buffer.append("interface "); //$NON-NLS-1$
++ buffer.append((this.compoundName != null) ? CharOperation.toString(this.compoundName) : "UNNAMED TYPE"); //$NON-NLS-1$
++
++ if (this.typeVariables == null) {
++ buffer.append("<NULL TYPE VARIABLES>"); //$NON-NLS-1$
++ } else if (this.typeVariables != Binding.NO_TYPE_VARIABLES) {
++ buffer.append("<"); //$NON-NLS-1$
++ for (int i = 0, length = this.typeVariables.length; i < length; i++) {
++ if (i > 0) buffer.append(", "); //$NON-NLS-1$
++ if (this.typeVariables[i] == null) {
++ buffer.append("NULL TYPE VARIABLE"); //$NON-NLS-1$
++ continue;
++ }
++ char[] varChars = this.typeVariables[i].toString().toCharArray();
++ buffer.append(varChars, 1, varChars.length - 2);
++ }
++ buffer.append(">"); //$NON-NLS-1$
++ }
++ buffer.append("\n\textends "); //$NON-NLS-1$
++ buffer.append((this.superclass != null) ? this.superclass.debugName() : "NULL TYPE"); //$NON-NLS-1$
++
++ if (this.superInterfaces != null) {
++ if (this.superInterfaces != Binding.NO_SUPERINTERFACES) {
++ buffer.append("\n\timplements : "); //$NON-NLS-1$
++ for (int i = 0, length = this.superInterfaces.length; i < length; i++) {
++ if (i > 0)
++ buffer.append(", "); //$NON-NLS-1$
++ buffer.append((this.superInterfaces[i] != null) ? this.superInterfaces[i].debugName() : "NULL TYPE"); //$NON-NLS-1$
++ }
++ }
++ } else {
++ buffer.append("NULL SUPERINTERFACES"); //$NON-NLS-1$
++ }
++
++ if (enclosingType() != null) {
++ buffer.append("\n\tenclosing type : "); //$NON-NLS-1$
++ buffer.append(enclosingType().debugName());
++ }
++
++ if (this.fields != null) {
++ if (this.fields != Binding.NO_FIELDS) {
++ buffer.append("\n/* fields */"); //$NON-NLS-1$
++ for (int i = 0, length = this.fields.length; i < length; i++)
++ buffer.append('\n').append((this.fields[i] != null) ? this.fields[i].toString() : "NULL FIELD"); //$NON-NLS-1$
++ }
++ } else {
++ buffer.append("NULL FIELDS"); //$NON-NLS-1$
++ }
++
++ if (this.methods != null) {
++ if (this.methods != Binding.NO_METHODS) {
++ buffer.append("\n/* methods */"); //$NON-NLS-1$
++ for (int i = 0, length = this.methods.length; i < length; i++)
++ buffer.append('\n').append((this.methods[i] != null) ? this.methods[i].toString() : "NULL METHOD"); //$NON-NLS-1$
++ }
++ } else {
++ buffer.append("NULL METHODS"); //$NON-NLS-1$
++ }
++
++ if (this.memberTypes != null) {
++ if (this.memberTypes != Binding.NO_MEMBER_TYPES) {
++ buffer.append("\n/* members */"); //$NON-NLS-1$
++ for (int i = 0, length = this.memberTypes.length; i < length; i++)
++ buffer.append('\n').append((this.memberTypes[i] != null) ? this.memberTypes[i].toString() : "NULL TYPE"); //$NON-NLS-1$
++ }
++ } else {
++ buffer.append("NULL MEMBER TYPES"); //$NON-NLS-1$
++ }
+
+- buffer.append("\n\n"); //$NON-NLS-1$
+- return buffer.toString();
++ buffer.append("\n\n"); //$NON-NLS-1$
++ return buffer.toString();
+ }
+ public TypeVariableBinding[] typeVariables() {
+- return this.typeVariables;
++ return this.typeVariables;
+ }
+ void verifyMethods(MethodVerifier verifier) {
+- verifier.verify(this);
++ verifier.verify(this);
+
+- for (int i = this.memberTypes.length; --i >= 0;)
+- ((SourceTypeBinding) this.memberTypes[i]).verifyMethods(verifier);
++ for (int i = this.memberTypes.length; --i >= 0;)
++ ((SourceTypeBinding) this.memberTypes[i]).verifyMethods(verifier);
+ }
+ }
+Index: gwt-debian/dev/core/test/com/google/gwt/dev/javac/BinaryTypeReferenceRestrictionsCheckerTest.java
+===================================================================
+--- gwt-debian.orig/dev/core/test/com/google/gwt/dev/javac/BinaryTypeReferenceRestrictionsCheckerTest.java 2011-12-21 11:44:26.308746537 +0100
++++ gwt-debian/dev/core/test/com/google/gwt/dev/javac/BinaryTypeReferenceRestrictionsCheckerTest.java 2011-12-21 11:45:03.408745229 +0100
+@@ -1,12 +1,12 @@
+ /*
+ * Copyright 2008 Google Inc.
+- *
++ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+- *
++ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+- *
++ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+@@ -47,7 +47,7 @@
+ import java.util.List;
+
+ /**
+- *
++ *
+ */
+ public class BinaryTypeReferenceRestrictionsCheckerTest extends TestCase {
+ /**
Modified: gwt/trunk/debian/patches/build.patch
===================================================================
--- gwt/trunk/debian/patches/build.patch 2012-06-13 04:16:44 UTC (rev 217)
+++ gwt/trunk/debian/patches/build.patch 2012-07-04 12:08:19 UTC (rev 218)
@@ -4,9 +4,24 @@
Authors: Thierry Carrez <thierry.carrez at ubuntu.com>, Charles Plessy <plessy at debian.org>
Forwarded: no
---- a/common.ant.xml
-+++ b/common.ant.xml
-@@ -47,7 +47,7 @@
+Index: gwt-debian/common.ant.xml
+===================================================================
+--- gwt-debian.orig/common.ant.xml 2011-12-21 12:06:16.832747948 +0100
++++ gwt-debian/common.ant.xml 2011-12-21 12:06:19.940747693 +0100
+@@ -35,6 +35,7 @@
+ </condition>
+ <property name="gwt.tools" location="${gwt.tools.check}" />
+ <property name="gwt.tools.lib" location="${gwt.tools}/lib" />
++ <property name="gwt.exttools.lib" location="${env.GWT_EXTTOOLS}/lib" />
+ <property name="gwt.tools.antlib" location="${gwt.tools}/antlib" />
+ <property name="gwt.tools.redist" location="${gwt.tools}/redist" />
+ <property name="gwt.build" location="${gwt.root}/build" />
+@@ -43,11 +44,11 @@
+ <property name="gwt.build.jni" location="${gwt.build}/jni" />
+ <property name="gwt.build.staging" location="${gwt.build}/staging" />
+ <property name="gwt.build.dist" location="${gwt.build}/dist" />
+- <!-- gwt.threadsPerProcessor supercedes gwt.threadCount unless set to 0 -->
++ <!-- gwt.threadsPerProcessor supercedes gwt.threadCount unless set to 0 -->
<property name="gwt.threadsPerProcessor" value="1" />
<property name="gwt.threadCount" value="1" />
<property name="project.build" location="${gwt.build.out}/${project.tail}" />
@@ -15,18 +30,73 @@
<property name="project.jni" location="${gwt.build}/${project.tail}" />
<property name="javac.out" location="${project.build}/bin" />
<property name="javac.junit.out" location="${project.build}/bin-test" />
-@@ -62,10 +62,6 @@
+@@ -61,10 +62,21 @@
+ <property name="junit.out" location="${project.build}/test" />
<property name="emma.dir" value="${gwt.tools.redist}/emma" />
<property name="emma.filter.exclude" value="" />
-
-- <!-- Sanity check -->
-- <available file="${gwt.tools}" type="dir" property="gwt.tools.exists" />
+-
++
+ <!-- Sanity check -->
+ <available file="${gwt.tools}" type="dir" property="gwt.tools.exists" />
- <fail unless="gwt.tools.exists" message="Cannot find '${gwt.tools}' tools directory; perhaps you should define the GWT_TOOLS environment variable" />
--
++ <fail message="Cannot find '${gwt.tools}' tools directory; perhaps you should define the GWT_TOOLS environment variable">
++ <condition>
++ <and>
++ <not>
++ <isset property="gwt.tools.exists"/>
++ </not>
++ <not>
++ <isset property="gwt.vendor.builddeps"/>
++ </not>
++ </and>
++ </condition>
++ </fail>
+
<!-- Platform identification -->
<condition property="build.host.islinux">
- <and>
-@@ -142,6 +138,7 @@
+@@ -96,16 +108,16 @@
+ <isset property="build.host.iswindows" />
+ </condition>
+ <fail unless="build.host.platform" message="Building on ${os.name} is not supported" />
+-
++
+ <!-- JVM -->
+ <condition property="build.jvm.is15">
+ <equals arg1="${ant.java.version}" arg2="1.5"/>
+- </condition>
++ </condition>
+
+ <condition property="build.jvm.is16">
+ <equals arg1="${ant.java.version}" arg2="1.6"/>
+- </condition>
+-
++ </condition>
++
+ <!-- JUnit support -->
+ <property name="gwt.dev.staging.jar" location="${gwt.build.staging}/gwt-${gwt.version}/gwt-dev.jar" />
+ <property name="gwt.junit.port" value="8888" />
+@@ -125,23 +137,24 @@
+ <!-- Pulls in tasks defined in ant-contrib, i.e. foreach -->
+ <taskdef resource="net/sf/antcontrib/antlib.xml">
+ <classpath>
+- <pathelement location="${gwt.tools.antlib}/ant-contrib-1.0b3.jar" />
++ <pathelement location="/usr/share/java/ant-contrib.jar" />
+ </classpath>
+ </taskdef>
+-
+-
++
++
+ <!-- Pulls in tasks defined in antcount, i.e. countfilter -->
+ <taskdef resource="net/sf/antcount/antlib.xml">
+ <classpath>
+ <pathelement location="${gwt.tools.antlib}/antcount-1.2.jar" />
+ </classpath>
+ </taskdef>
+-
++
+
+ <!-- Global Custom Tasks -->
<presetdef name="gwt.ant">
<ant inheritall="false" target="${target}">
<propertyset>
@@ -34,18 +104,139 @@
<propertyref name="gwt.version" />
<propertyref name="gwt.junit.port" />
<propertyref name="gwt.remote.browsers" />
---- a/dev/build.xml
-+++ b/dev/build.xml
-@@ -26,8 +26,6 @@
+@@ -260,7 +273,7 @@
+ </report>
+ </emma>
+
+- <condition property="junit.stop.build" value="true">
++ <condition property="junit.stop.build" value="true">
+ <and>
+ <istrue value="@{haltonfailure}"/>
+ <isset property="junit.failure"/>
+@@ -295,16 +308,16 @@
+ be noticed as invalidating the previously-generated filter output. This property
+ names where such a sentinel lives; it is tested with <available/> and created
+ with <touch/> -->
+- <mkdir dir="${project.build}/sentinels" />
+- <property name="filter.sentinel"
+- location="${project.build}/sentinels/gwt-${gwt.version}-svn-${gwt.svnrev.filename}" />
++ <mkdir dir="${project.build}/sentinels" />
++ <property name="filter.sentinel"
++ location="${project.build}/sentinels/gwt-${gwt.version}-svn-${gwt.svnrev.filename}" />
+ </sequential>
+ </macrodef>
+-
++
+ <macrodef name="gwt.revfilter" description="Filters files for versioning">
+ <attribute name="todir" description="Destination for the filtered copy"/>
+-
+- <element name="src.fileset" implicit="true"
++
++ <element name="src.fileset" implicit="true"
+ description="Source for the filtered copy"/>
+ <sequential>
+ <!-- These files must be filtered for versioning -->
+@@ -324,7 +337,7 @@
+ <attribute name="name"/>
+ <element name="timer.elements" implicit="true" optional="false"/>
+ <sequential>
+- <taskdef name="timer"
++ <taskdef name="timer"
+ classname="com.google.gwt.ant.taskdefs.Timer"
+ classpath="${gwt.build.lib}/ant-gwt.jar" />
+ <timer name="@{name}">
+@@ -380,7 +393,7 @@
+ </sequential>
+ </macrodef>
+
+- <!-- Targets for emma support. To run tests with emma enabled, use
++ <!-- Targets for emma support. To run tests with emma enabled, use
+ ant <test-target> -Demma.enabled=true -->
+ <path id="emma.taskdef.lib">
+ <pathelement location="${emma.dir}/emma-2.0.5312-patched.jar" />
+Index: gwt-debian/dev/build.xml
+===================================================================
+--- gwt-debian.orig/dev/build.xml 2011-12-21 12:06:16.884746052 +0100
++++ gwt-debian/dev/build.xml 2011-12-21 12:14:31.592744885 +0100
+@@ -6,6 +6,20 @@
+ <import file="${gwt.root}/platforms.ant.xml" />
+ <import file="${gwt.root}/common.ant.xml" />
+
++ <path id="gwt.dev.build.classpath">
++ <pathelement location="${ant.jar}" />
++ <pathelement location="${commons-collections3.jar}" />
++ <pathelement location="${servlet-api.jar}" />
++ <pathelement location="${htmlunit.jar}" />
++ <pathelement location="${htmlunit-core-js.jar}" />
++ <pathelement location="${jetty.jar}" />
++ <pathelement location="${jetty-util.jar}" />
++ <pathelement location="${protobuf.jar}" />
++ <pathelement location="${commons-logging.jar}" />
++ <pathelement location="${jdt.jar}" />
++ <pathelement location="${guava.jar}" />
++ </path>
++
+ <property name="alldeps.jar" location="${project.build}/alldeps.jar" />
+ <property name="gwt.junit.testcase.dev.core.includes" value="**/com/google/**/*Test.class" />
+ <!-- BrowserManagerTest is brought in from user and is not instantiable. -->
+@@ -19,32 +33,42 @@
+ </delete>
+ </target>
+
+- <target name="compile.tests" depends="build, compile.emma.if.enabled, build.alldeps.jar" description="Compiles the test code for this project">
++ <target name="compile.tests" depends="build, compile.emma.if.enabled" description="Compiles the test code for this project">
+ <mkdir dir="${javac.junit.out}" />
+ <gwt.javac srcdir="" destdir="${javac.junit.out}">
+ <src path="core/src" />
<src path="core/test" />
<classpath>
<pathelement location="${javac.out}" />
- <pathelement location="${alldeps.jar}" />
- <pathelement location="${gwt.tools.lib}/junit/junit-4.8.2.jar" />
++ <path refid="gwt.dev.build.classpath" />
++ <pathelement location="${gwt.exttools.lib}/tomcat/catalina-1.0.jar" />
++ <pathelement location="${gwt.exttools.lib}/tomcat/catalina-optional-1.0.jar" />
++ <pathelement location="${gwt.exttools.lib}/tomcat/naming-common-1.0.jar" />
++ <pathelement location="${gwt.exttools.lib}/tomcat/naming-resources-1.0.jar" />
++ <pathelement location="${gwt.exttools.lib}/tomcat/tomcat-util-5.1.jar" />
</classpath>
</gwt.javac>
<gwt.javac srcdir="${gwt.root}/user/src" destdir="${javac.junit.out}"
-@@ -117,66 +115,6 @@
+ excludes="**/super/**">
+ <classpath>
+ <pathelement location="${javac.out}" />
+- <pathelement location="${gwt.tools.lib}/tomcat/servlet-api-2.5.jar" />
+- <pathelement location="${gwt.tools.lib}/junit/junit-4.8.2.jar" />
+- <pathelement location="${gwt.tools.lib}/jfreechart/jfreechart-1.0.3.jar" />
+- <pathelement location="${gwt.tools.lib}/selenium/selenium-java-client-driver.jar" />
+- <pathelement location="${gwt.tools.lib}/w3c/sac/sac-1.3.jar" />
+- <pathelement location="${gwt.tools.lib}/w3c/flute/flute-1.3-gg2.jar" />
+- <pathelement location="${gwt.tools}/redist/json/r2_20080312/json-1.5.jar" />
+- <pathelement location="${gwt.tools.lib}/hibernate/validator/hibernate-validator-4.1.0.Final.jar" />
+- <pathelement location="${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA.jar" />
+- <pathelement location="${gwt.build.lib}/gwt-dev-${build.host.platform}.jar" />
+- <pathelement location="${alldeps.jar}" />
++ <pathelement location="${servlet-api.jar}" />
++ <pathelement location="${jetty.jar}" />
++ <pathelement location="${jetty-util.jar}" />
++ <pathelement location="${icu4j.jar}" />
++ <pathelement location="${htmlunit.jar}" />
++ <pathelement location="${htmlunit-core-js.jar}" />
++ <pathelement location="${guava.jar}" />
++ <pathelement location="${jsilver.jar}" />
++ <pathelement location="${junit4.jar}" />
++ <pathelement location="${jfreechart.jar}" />
++ <pathelement location="${gwt.exttools.lib}/selenium/selenium-java-client-driver.jar" />
++ <pathelement location="${sac.jar}" />
++ <pathelement location="${flute.jar}" />
++ <pathelement location="${json-simple.jar}" />
++ <pathelement location="${hibernate-validator.jar}" />
++ <pathelement location="${geronimo-validation.jar}" />
++ <pathelement location="${target.dir}/gwt-dev-${artifactVersion}.jar" />
+ </classpath>
+ </gwt.javac>
+
+@@ -117,66 +141,6 @@
<targetfiles>
<fileset file="${alldeps.jar}"/>
</targetfiles>
@@ -112,16 +303,113 @@
</outofdate>
</target>
-@@ -232,7 +170,6 @@
+@@ -212,37 +176,21 @@
+ <include name="com/google/gwt/util/**"/>
+ <include name="org/eclipse/jdt/**"/>
+ <classpath>
+- <pathelement location="${gwt.tools.lib}/apache/ant-1.6.5.jar" />
+- <pathelement location="${gwt.tools.lib}/eclipse/jdt-3.4.2.jar" />
+- <pathelement location="${gwt.tools.lib}/tomcat/commons-collections-3.1.jar" />
+- <pathelement location="${gwt.tools.lib}/guava/guava-r06/guava-r06-rebased-2.jar" />
++ <path refid="gwt.dev.build.classpath" />
+ </classpath>
+ </gwt.javac>
+ </target>
+-
+- <target name="compile" depends="compiler.standalone, build.alldeps.jar" description="Compiles this project">
++
++ <target name="compile" depends="compiler.standalone" description="Compiles this project">
+ <gwt.javac srcdir="" excludes="${filter.pattern}">
+ <src path="core/src" />
+ <classpath>
+- <pathelement location="${alldeps.jar}" />
++ <path refid="gwt.dev.build.classpath" />
+ </classpath>
+ </gwt.javac>
+ <copy todir="${javac.out}">
+ <fileset dir="core/src" includes="**/*.properties" excludes="${filter.pattern}"/>
</copy>
+-
+- <!-- Files with hardcoded version information must be filtered -->
+- <gwt.getsvninfo />
+- <condition property="filter.uptodate">
+- <and>
+- <available file="${filter.sentinel}" />
+- <uptodate>
+- <srcfiles dir="core/src" includes="${filter.pattern}" />
+- <globmapper from="*" to="${javac.out}/*" />
+- </uptodate>
+- </and>
+- </condition>
+- <antcall target="-filter.props" />
+ </target>
- <!-- Files with hardcoded version information must be filtered -->
-- <gwt.getsvninfo />
- <condition property="filter.uptodate">
- <and>
- <available file="${filter.sentinel}" />
---- a/dev/common.ant.xml
-+++ b/dev/common.ant.xml
+ <target name="generate.remotemessageproto.java">
+@@ -251,13 +199,13 @@
+ <arg value="--java_out=core/src"/>
+ <arg value="./core/src/com/google/gwt/dev/shell/remoteui/remotemessage.proto"/>
+ </exec>
+-
++
+ <!-- Rebase the java code to match the rebased protobuf library -->
+ <replace file="./core/src/com/google/gwt/dev/shell/remoteui/RemoteMessageProto.java">
+ <replacefilter token="com.google.protobuf" value="com.google.gwt.dev.protobuf"/>
+ </replace>
+ </target>
+-
++
+ <target name="checkstyle" description="Static analysis of source">
+ <gwt.checkstyle>
+ <fileset dir="core/src">
+@@ -302,6 +250,7 @@
+ <property.ensure name="gwt.tools.soyc" location="${gwt.root}/tools/soyc-vis" />
+ <target name="build" depends="compile" description="Build and package this project">
+ <mkdir dir="${gwt.build.lib}" />
++ <mkdir dir="${target.dir}" />
+ <outofdate>
+ <sourcefiles>
+ <fileset dir="core/src">
+@@ -311,7 +260,6 @@
+ <fileset dir="core/super" excludes="**/package.html" />
+ <fileset dir="${javac.out}" />
+ <fileset dir="${project.build}/bin" />
+- <fileset file="${project.build}/alldeps.jar" />
+ <fileset file="${gwt.tools.soyc}/classLevel.css"/>
+ <fileset file="${gwt.tools.soyc}/roundedCorners.css"/>
+ </sourcefiles>
+@@ -319,22 +267,25 @@
+ <fileset file="${project.lib}"/>
+ </targetfiles>
+ <sequential>
+- <gwt.jar>
++ <pathconvert property="manifest.class.path" pathsep=" ">
++ <path refid="gwt.dev.build.classpath" />
++ </pathconvert>
++ <jar destfile="${project.lib}">
+ <fileset dir="core/src">
+ <exclude name="**/package.html"/>
+ <exclude name="**/*.properties"/> <!-- copied and/or filtered into bin -->
+ </fileset>
+ <fileset dir="core/super" excludes="**/package.html" />
+ <fileset dir="${javac.out}" />
+- <zipfileset src="${alldeps.jar}" />
+
+ <zipfileset file="${gwt.tools.soyc}/classLevel.css" prefix="com/google/gwt/soyc/resources/"/>
+ <zipfileset file="${gwt.tools.soyc}/roundedCorners.css" prefix="com/google/gwt/soyc/resources/"/>
+
+ <manifest>
+ <attribute name="Main-Class" value="com.google.gwt.dev.GWTMain" />
++ <attribute name="Class-Path" value="${manifest.class.path}"/>
+ </manifest>
+- </gwt.jar>
++ </jar>
+ </sequential>
+ </outofdate>
+ </target>
+Index: gwt-debian/dev/common.ant.xml
+===================================================================
+--- gwt-debian.orig/dev/common.ant.xml 2011-12-21 12:06:16.868746242 +0100
++++ gwt-debian/dev/common.ant.xml 2011-12-21 12:06:19.964745406 +0100
@@ -8,15 +8,16 @@
<target name="compile" description="Compile all java files">
<mkdir dir="${javac.out}" />
@@ -149,18 +437,45 @@
<manifest>
<attribute name="Main-Class" value="com.google.gwt.dev.GWTMain" />
---- a/user/build.xml
-+++ b/user/build.xml
-@@ -53,7 +53,7 @@
+Index: gwt-debian/user/build.xml
+===================================================================
+--- gwt-debian.orig/user/build.xml 2011-12-21 12:06:16.856749605 +0100
++++ gwt-debian/user/build.xml 2011-12-21 12:13:50.729248038 +0100
+@@ -31,7 +31,7 @@
+ <property name="benchmark.timeout" value="30" />
+ <property name="gwt.benchmark.testcase.web.includes" value="${gwt.benchmark.testcase.includes}" />
+ <property name="gwt.benchmark.testcase.web.excludes" value="${gwt.benchmark.testcase.excludes}" />
+-
++
+ <property name="gwt.tck.testcase.dev.includes" value="com/google/gwt/validation/tck/**/*GwtSuite.class" />
+ <property name="gwt.tct.testcase.dev.excludes" value="" />
+
+@@ -53,7 +53,23 @@
<property name="gwt.i18n.test.InnerClassChar" value="dollar"/>
<!-- Platform shouldn't matter here, just picking one -->
- <property.ensure name="gwt.dev.jar" location="${gwt.build.lib}/gwt-dev.jar" />
-+ <property.ensure name="gwt.dev.jar" location="${target.dir}/gwt-dev-linux-${artifactVersion}.jar" />
++ <property.ensure name="gwt.dev.jar" location="${target.dir}/gwt-dev-${artifactVersion}.jar" />
++
++ <path id="gwt.user.build.classpath">
++ <pathelement location="${jetty.jar}" />
++ <pathelement location="${jetty-util.jar}" />
++ <pathelement location="${guava.jar}" />
++ <pathelement location="${servlet-api.jar}" />
++ <pathelement location="${icu4j.jar}" />
++ <pathelement location="${jsilver.jar}" />
++ <pathelement location="${htmlunit.jar}" />
++ <pathelement location="${htmlunit-core-js.jar}" />
++ <pathelement location="${flute.jar}" />
++ <pathelement location="${json.jar}" />
++ <pathelement location="${geronimo-validation.jar}" />
++ <pathelement location="${hibernate-validator.jar}" />
++ <pathelement location="${gwt.dev.jar}" />
++ </path>
<!--
Classpaths added for test cases
-@@ -92,11 +92,8 @@
+@@ -92,30 +108,17 @@
unless="compile.complete">
<mkdir dir="${javac.out}" />
<gwt.javac excludes="**/super/**">
@@ -170,11 +485,19 @@
- <pathelement location="${gwt.tools.lib}/junit/junit-4.8.2.jar" />
- <pathelement location="${gwt.tools.lib}/jfreechart/jfreechart-1.0.3.jar" />
- <pathelement location="${gwt.tools.lib}/selenium/selenium-java-client-driver.jar" />
- <pathelement location="${gwt.tools.lib}/w3c/sac/sac-1.3.jar" />
- <pathelement location="${gwt.tools.lib}/w3c/flute/flute-1.3-gg2.jar" />
- <pathelement location="${gwt.tools}/redist/json/r2_20080312/json-1.5.jar" />
-@@ -111,11 +108,6 @@
- <pathelement location="${gwt.dev.jar}" />
+- <pathelement location="${gwt.tools.lib}/w3c/sac/sac-1.3.jar" />
+- <pathelement location="${gwt.tools.lib}/w3c/flute/flute-1.3-gg2.jar" />
+- <pathelement location="${gwt.tools}/redist/json/r2_20080312/json-1.5.jar" />
+- <pathelement location="${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA.jar" />
++ <path refid="gwt.user.build.classpath" />
+ <!-- The source is included so validation is available from client code -->
+ <pathelement location="${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA-sources.jar" />
+ <!-- Hibernate is included until we can provide the super source as an third party jar" -->
+- <pathelement location="${gwt.tools.lib}/hibernate/validator/hibernate-validator-4.1.0.Final.jar" />
+ <pathelement location="${gwt.tools.lib}/hibernate/validator/hibernate-validator-4.1.0.Final-sources.jar" />
+ <!-- Bootstrap support needed for obfuscated type tokens for JRE runtime -->
+ <pathelement location="${gwt.tools.lib}/requestfactory/requestfactory-apt.jar" />
+- <pathelement location="${gwt.dev.jar}" />
</classpath>
</gwt.javac>
-
@@ -185,11 +508,87 @@
</target>
<!--
-@@ -210,7 +202,6 @@
+@@ -206,14 +209,17 @@
+ <target name="build" depends="compile"
+ description="Build and package this project">
+ <mkdir dir="${gwt.build.lib}" />
+- <gwt.jar>
++ <pathconvert property="manifest.class.path" pathsep=" ">
++ <path refid="gwt.user.build.classpath" />
++ </pathconvert>
++ <jar destfile="${project.lib}">
<fileset dir="src" excludes="**/package.html" />
<fileset dir="super" excludes="**/package.html" />
<fileset dir="${javac.out}" />
- <zipfileset src="${gwt.tools.lib}/tomcat/servlet-api-2.5.jar" excludes="**/*.java"/>
- <zipfileset src="${gwt.tools.lib}/w3c/sac/sac-1.3.jar" />
- <zipfileset src="${gwt.tools.lib}/w3c/flute/flute-1.3-gg2.jar" />
- </gwt.jar>
+- <zipfileset src="${gwt.tools.lib}/w3c/sac/sac-1.3.jar" />
+- <zipfileset src="${gwt.tools.lib}/w3c/flute/flute-1.3-gg2.jar" />
+- </gwt.jar>
++ <manifest>
++ <attribute name="Class-Path" value="${manifest.class.path}"/>
++ </manifest>
++ </jar>
+ </target>
+
+ <target name="checkstyle" description="Static analysis of source">
+Index: gwt-debian/servlet/build.xml
+===================================================================
+--- gwt-debian.orig/servlet/build.xml 2011-12-21 12:06:16.900746798 +0100
++++ gwt-debian/servlet/build.xml 2011-12-21 12:06:19.968744905 +0100
+@@ -13,7 +13,7 @@
+ location="${gwt.build.lib}/gwt-${ant.project.name}-deps.jar" />
+
+ <target name="build" description="Packages this project into a jar"
+- depends="-servlet, -deps" />
++ depends="-servlet" />
+
+ <target name="clean" description="Cleans this project's intermediate and output files">
+ <delete file="${project.lib}" />
+@@ -22,7 +22,7 @@
+
+ <target name="-servlet" description="Packages this project into a jar">
+ <mkdir dir="${gwt.build.lib}" />
+- <gwt.jar>
++ <jar destfile="${project.lib}">
+ <fileset dir="${gwt.dev.bin}">
+ <include name="com/google/gwt/dev/asm/**" />
+ <include name="com/google/gwt/dev/util/Name*.class" />
+@@ -43,7 +43,7 @@
+ </fileset>
+
+ <!-- additional dependencies (used by scripts). -->
+- </gwt.jar>
++ </jar>
+ </target>
+
+ <target name="-deps" description="Packages this project's dependencies into a jar">
+Index: gwt-debian/tools.properties
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gwt-debian/tools.properties 2011-12-21 12:06:19.968744905 +0100
+@@ -0,0 +1,25 @@
++ant-contrib.jar = ${gwt.tools.antlib}/ant-contrib-1.0b3.jar
++
++# Common
++commons-collections3.jar = ${gwt.tools.lib}/tomcat/commons-collections-3.1.jar
++guava.jar = ${gwt.tools.lib}/guava/guava-r06/guava-r06-rebased-2.jar
++servlet-api.jar = ${gwt.tools.lib}/tomcat/servlet-api-2.5.jar
++htmlunit.jar = /usr/share/java/htmlunit.jar
++htmlunit-core-js.jar = /usr/share/java/htmlunit-core-js.jar
++jetty.jar = /usr/share/java/jetty.jar
++jetty-util.jar = /usr/share/java/jetty-util.jar
++
++# Dev
++ant.jar = ${gwt.tools.lib}/apache/ant-1.6.5.jar
++ecj.jar = /usr/share/java/ecj.jar
++jdt.jar = ${gwt.tools.lib}/eclipse/jdt-3.4.2.jar
++protobuf.jar = /usr/share/java/protobuf.jar
++commons-logging.jar = /usr/share/java/commons-logging.jar
++
++# User
++icu4j.jar = /usr/share/java/icu4j.jar
++jsilver.jar = /usr/share/java/jsilver.jar
++flute.jar = ${gwt.tools.lib}/w3c/flute/flute-1.3-gg2.jar
++json.jar = ${gwt.tools}/redist/json/r2_20080312/json-1.5.jar
++geronimo-validation.jar = ${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA.jar
++hibernate-validator.jar = ${gwt.tools.lib}/hibernate/validator/hibernate-validator-4.1.0.Final.jar
Modified: gwt/trunk/debian/patches/exclude-tomcat.patch
===================================================================
--- gwt/trunk/debian/patches/exclude-tomcat.patch 2012-06-13 04:16:44 UTC (rev 217)
+++ gwt/trunk/debian/patches/exclude-tomcat.patch 2012-07-04 12:08:19 UTC (rev 218)
@@ -2,9 +2,11 @@
Author: Thierry Carrez <thierry.carrez at ubuntu.com>
Forwarded: no
---- a/dev/build.xml
-+++ b/dev/build.xml
-@@ -118,7 +118,7 @@
+Index: gwt-debian/dev/build.xml
+===================================================================
+--- gwt-debian.orig/dev/build.xml 2011-12-21 11:23:41.692747204 +0100
++++ gwt-debian/dev/build.xml 2011-12-21 11:23:54.429246513 +0100
+@@ -149,7 +149,7 @@
</outofdate>
</target>
@@ -13,9 +15,11 @@
<target name="-filter.props" description="Creates filtered About.properties with version info"
unless="filter.uptodate">
---- a/dev/core/src/com/google/gwt/dev/GWTShell.java
-+++ b/dev/core/src/com/google/gwt/dev/GWTShell.java
-@@ -22,7 +22,6 @@ import com.google.gwt.core.ext.linker.EmittedArtifact.Visibility;
+Index: gwt-debian/dev/core/src/com/google/gwt/dev/GWTShell.java
+===================================================================
+--- gwt-debian.orig/dev/core/src/com/google/gwt/dev/GWTShell.java 2011-12-21 09:20:38.096746270 +0100
++++ gwt-debian/dev/core/src/com/google/gwt/dev/GWTShell.java 2011-12-21 11:23:54.433245796 +0100
+@@ -22,7 +22,6 @@
import com.google.gwt.core.ext.linker.impl.StandardLinkerContext;
import com.google.gwt.dev.cfg.ModuleDef;
import com.google.gwt.dev.shell.WorkDirs;
@@ -23,7 +27,7 @@
import com.google.gwt.dev.util.OutputFileSetOnDirectory;
import com.google.gwt.dev.util.arg.ArgHandlerDisableUpdateCheck;
import com.google.gwt.dev.util.arg.ArgHandlerOutDir;
-@@ -195,7 +194,6 @@ public class GWTShell extends DevModeBase {
+@@ -195,7 +194,6 @@
protected void doShutDownServer() {
// Stop the HTTP server.
//
@@ -31,7 +35,7 @@
}
@Override
-@@ -206,17 +204,7 @@ public class GWTShell extends DevModeBase {
+@@ -206,17 +204,7 @@
@Override
protected int doStartUpServer() {
Added: gwt/trunk/debian/patches/fix-guava-pkg-path
===================================================================
--- gwt/trunk/debian/patches/fix-guava-pkg-path (rev 0)
+++ gwt/trunk/debian/patches/fix-guava-pkg-path 2012-07-04 12:08:19 UTC (rev 218)
@@ -0,0 +1,155 @@
+Index: gwt-debian.git/dev/core/src/com/google/gwt/dev/util/StringInterner.java
+===================================================================
+--- gwt-debian.git.orig/dev/core/src/com/google/gwt/dev/util/StringInterner.java 2011-09-01 16:14:21.158642633 +0200
++++ gwt-debian.git/dev/core/src/com/google/gwt/dev/util/StringInterner.java 2011-09-01 16:29:41.794643479 +0200
+@@ -16,8 +16,8 @@
+
+ package com.google.gwt.dev.util;
+
+-import com.google.gwt.thirdparty.guava.common.collect.Interner;
+-import com.google.gwt.thirdparty.guava.common.collect.Interners;
++import com.google.common.collect.Interner;
++import com.google.common.collect.Interners;
+
+ /**
+ * A utility class for reducing String memory waste. Note that this does not use
+Index: gwt-debian.git/dev/core/src/com/google/gwt/dev/javac/CompilationUnitArchive.java
+===================================================================
+--- gwt-debian.git.orig/dev/core/src/com/google/gwt/dev/javac/CompilationUnitArchive.java 2011-09-01 16:14:21.198643075 +0200
++++ gwt-debian.git/dev/core/src/com/google/gwt/dev/javac/CompilationUnitArchive.java 2011-09-01 16:29:41.806641576 +0200
+@@ -15,7 +15,7 @@
+ */
+ package com.google.gwt.dev.javac;
+
+-import com.google.gwt.thirdparty.guava.common.collect.ImmutableMap;
++import com.google.common.collect.ImmutableMap;
+
+ import java.io.BufferedInputStream;
+ import java.io.BufferedOutputStream;
+Index: gwt-debian.git/dev/core/src/com/google/gwt/dev/util/Strings.java
+===================================================================
+--- gwt-debian.git.orig/dev/core/src/com/google/gwt/dev/util/Strings.java 2011-09-01 16:14:21.170642875 +0200
++++ gwt-debian.git/dev/core/src/com/google/gwt/dev/util/Strings.java 2011-09-01 16:29:41.810687441 +0200
+@@ -15,7 +15,7 @@
+ */
+ package com.google.gwt.dev.util;
+
+-import com.google.gwt.thirdparty.guava.common.collect.Lists;
++import com.google.common.collect.Lists;
+
+ import java.util.ArrayList;
+
+Index: gwt-debian.git/user/src/com/google/gwt/safehtml/shared/SafeHtmlHostedModeUtils.java
+===================================================================
+--- gwt-debian.git.orig/user/src/com/google/gwt/safehtml/shared/SafeHtmlHostedModeUtils.java 2011-09-01 16:34:27.598145122 +0200
++++ gwt-debian.git/user/src/com/google/gwt/safehtml/shared/SafeHtmlHostedModeUtils.java 2011-09-01 16:35:17.590142122 +0200
+@@ -16,7 +16,7 @@
+ package com.google.gwt.safehtml.shared;
+
+ import com.google.gwt.core.client.GWT;
+-import com.google.gwt.thirdparty.guava.common.base.Preconditions;
++import com.google.common.base.Preconditions;
+ import com.google.gwt.thirdparty.streamhtmlparser.HtmlParser;
+ import com.google.gwt.thirdparty.streamhtmlparser.HtmlParserFactory;
+ import com.google.gwt.thirdparty.streamhtmlparser.ParseException;
+Index: gwt-debian.git/user/src/com/google/gwt/safehtml/shared/SafeUriHostedModeUtils.java
+===================================================================
+--- gwt-debian.git.orig/user/src/com/google/gwt/safehtml/shared/SafeUriHostedModeUtils.java 2011-09-01 16:35:42.534142633 +0200
++++ gwt-debian.git/user/src/com/google/gwt/safehtml/shared/SafeUriHostedModeUtils.java 2011-09-01 16:35:52.390142207 +0200
+@@ -16,7 +16,7 @@
+ package com.google.gwt.safehtml.shared;
+
+ import com.google.gwt.core.client.GWT;
+-import com.google.gwt.thirdparty.guava.common.base.Preconditions;
++import com.google.common.base.Preconditions;
+
+ import java.net.URI;
+ import java.net.URISyntaxException;
+Index: gwt-debian.git/user/src/com/google/gwt/validation/rebind/BeanHelper.java
+===================================================================
+--- gwt-debian.git.orig/user/src/com/google/gwt/validation/rebind/BeanHelper.java 2011-09-01 16:39:59.534144664 +0200
++++ gwt-debian.git/user/src/com/google/gwt/validation/rebind/BeanHelper.java 2011-09-01 16:40:10.970142194 +0200
+@@ -26,7 +26,7 @@
+ import com.google.gwt.core.ext.typeinfo.JRawType;
+ import com.google.gwt.core.ext.typeinfo.JType;
+ import com.google.gwt.core.ext.typeinfo.NotFoundException;
+-import com.google.gwt.thirdparty.guava.common.base.Function;
++import com.google.common.base.Function;
+ import com.google.gwt.user.rebind.ClassSourceFileComposerFactory;
+ import com.google.gwt.user.rebind.SourceWriter;
+ import com.google.gwt.validation.client.impl.GwtSpecificValidator;
+Index: gwt-debian.git/user/src/com/google/gwt/validation/rebind/GwtSpecificValidatorCreator.java
+===================================================================
+--- gwt-debian.git.orig/user/src/com/google/gwt/validation/rebind/GwtSpecificValidatorCreator.java 2011-09-01 16:38:19.474145570 +0200
++++ gwt-debian.git/user/src/com/google/gwt/validation/rebind/GwtSpecificValidatorCreator.java 2011-09-01 16:39:02.942142236 +0200
+@@ -28,17 +28,17 @@
+ import com.google.gwt.core.ext.typeinfo.JType;
+ import com.google.gwt.core.ext.typeinfo.TypeOracle;
+ import com.google.gwt.dev.jjs.ast.JProgram;
+-import com.google.gwt.thirdparty.guava.common.base.Function;
+-import com.google.gwt.thirdparty.guava.common.base.Functions;
+-import com.google.gwt.thirdparty.guava.common.base.Joiner;
+-import com.google.gwt.thirdparty.guava.common.base.Predicate;
+-import com.google.gwt.thirdparty.guava.common.collect.ImmutableList;
+-import com.google.gwt.thirdparty.guava.common.collect.ImmutableSet;
+-import com.google.gwt.thirdparty.guava.common.collect.Iterables;
+-import com.google.gwt.thirdparty.guava.common.collect.Maps;
+-import com.google.gwt.thirdparty.guava.common.collect.Ordering;
+-import com.google.gwt.thirdparty.guava.common.collect.Sets;
+-import com.google.gwt.thirdparty.guava.common.primitives.Primitives;
++import com.google.common.base.Function;
++import com.google.common.base.Functions;
++import com.google.common.base.Joiner;
++import com.google.common.base.Predicate;
++import com.google.common.collect.ImmutableList;
++import com.google.common.collect.ImmutableSet;
++import com.google.common.collect.Iterables;
++import com.google.common.collect.Maps;
++import com.google.common.collect.Ordering;
++import com.google.common.collect.Sets;
++import com.google.common.primitives.Primitives;
+ import com.google.gwt.user.rebind.ClassSourceFileComposerFactory;
+ import com.google.gwt.user.rebind.SourceWriter;
+ import com.google.gwt.validation.client.impl.AbstractGwtSpecificValidator;
+Index: gwt-debian.git/user/src/com/google/gwt/validation/rebind/Util.java
+===================================================================
+--- gwt-debian.git.orig/user/src/com/google/gwt/validation/rebind/Util.java 2011-09-01 16:39:17.870143823 +0200
++++ gwt-debian.git/user/src/com/google/gwt/validation/rebind/Util.java 2011-09-01 16:39:43.870142623 +0200
+@@ -15,14 +15,14 @@
+ */
+ package com.google.gwt.validation.rebind;
+
+-import com.google.gwt.thirdparty.guava.common.base.Function;
+-import com.google.gwt.thirdparty.guava.common.base.Functions;
+-import com.google.gwt.thirdparty.guava.common.base.Predicate;
+-import com.google.gwt.thirdparty.guava.common.collect.ImmutableList;
+-import com.google.gwt.thirdparty.guava.common.collect.ImmutableSet;
+-import com.google.gwt.thirdparty.guava.common.collect.Iterables;
+-import com.google.gwt.thirdparty.guava.common.collect.Lists;
+-import com.google.gwt.thirdparty.guava.common.collect.Sets;
++import com.google.common.base.Function;
++import com.google.common.base.Functions;
++import com.google.common.base.Predicate;
++import com.google.common.collect.ImmutableList;
++import com.google.common.collect.ImmutableSet;
++import com.google.common.collect.Iterables;
++import com.google.common.collect.Lists;
++import com.google.common.collect.Sets;
+
+ import java.util.HashSet;
+ import java.util.Iterator;
+Index: gwt-debian.git/user/src/com/google/gwt/validation/rebind/ValidatorCreator.java
+===================================================================
+--- gwt-debian.git.orig/user/src/com/google/gwt/validation/rebind/ValidatorCreator.java 2011-09-01 16:40:25.210144901 +0200
++++ gwt-debian.git/user/src/com/google/gwt/validation/rebind/ValidatorCreator.java 2011-09-01 16:40:37.642142278 +0200
+@@ -20,8 +20,8 @@
+ import com.google.gwt.core.ext.TreeLogger;
+ import com.google.gwt.core.ext.UnableToCompleteException;
+ import com.google.gwt.core.ext.typeinfo.JClassType;
+-import com.google.gwt.thirdparty.guava.common.collect.ImmutableList;
+-import com.google.gwt.thirdparty.guava.common.collect.Lists;
++import com.google.common.collect.ImmutableList;
++import com.google.common.collect.Lists;
+ import com.google.gwt.user.rebind.ClassSourceFileComposerFactory;
+ import com.google.gwt.user.rebind.SourceWriter;
+ import com.google.gwt.validation.client.GwtValidation;
Added: gwt/trunk/debian/patches/fix-protobuf-pkg-path
===================================================================
--- gwt/trunk/debian/patches/fix-protobuf-pkg-path (rev 0)
+++ gwt/trunk/debian/patches/fix-protobuf-pkg-path 2012-07-04 12:08:19 UTC (rev 218)
@@ -0,0 +1,13 @@
+Index: gwt-2.4.0/dev/core/src/com/google/gwt/dev/shell/remoteui/ViewerServiceClient.java
+===================================================================
+--- gwt-2.4.0.orig/dev/core/src/com/google/gwt/dev/shell/remoteui/ViewerServiceClient.java 2011-08-31 11:03:33.334643306 +0200
++++ gwt-2.4.0/dev/core/src/com/google/gwt/dev/shell/remoteui/ViewerServiceClient.java 2011-08-31 11:04:27.578641364 +0200
+@@ -18,7 +18,7 @@
+ import com.google.gwt.core.ext.TreeLogger;
+ import com.google.gwt.core.ext.TreeLogger.HelpInfo;
+ import com.google.gwt.core.ext.TreeLogger.Type;
+-import com.google.gwt.dev.protobuf.ByteString;
++import com.google.protobuf.ByteString;
+ import com.google.gwt.dev.shell.remoteui.MessageTransport.RequestException;
+ import com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request;
+ import com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Response;
Added: gwt/trunk/debian/patches/fix-streamhtmlparser-pkg-path
===================================================================
--- gwt/trunk/debian/patches/fix-streamhtmlparser-pkg-path (rev 0)
+++ gwt/trunk/debian/patches/fix-streamhtmlparser-pkg-path 2012-07-04 12:08:19 UTC (rev 218)
@@ -0,0 +1,34 @@
+Index: gwt-debian.git/user/src/com/google/gwt/safehtml/rebind/HtmlTemplateParser.java
+===================================================================
+--- gwt-debian.git.orig/user/src/com/google/gwt/safehtml/rebind/HtmlTemplateParser.java 2011-09-05 10:28:53.026643210 +0200
++++ gwt-debian.git/user/src/com/google/gwt/safehtml/rebind/HtmlTemplateParser.java 2011-09-05 10:29:36.042643760 +0200
+@@ -20,9 +20,9 @@
+ import com.google.gwt.dev.util.Preconditions;
+ import com.google.gwt.safehtml.rebind.ParsedHtmlTemplate.HtmlContext;
+ import com.google.gwt.safehtml.rebind.ParsedHtmlTemplate.ParameterChunk;
+-import com.google.gwt.thirdparty.streamhtmlparser.HtmlParser;
+-import com.google.gwt.thirdparty.streamhtmlparser.HtmlParserFactory;
+-import com.google.gwt.thirdparty.streamhtmlparser.ParseException;
++import com.google.streamhtmlparser.HtmlParser;
++import com.google.streamhtmlparser.HtmlParserFactory;
++import com.google.streamhtmlparser.ParseException;
+
+ import java.util.regex.Matcher;
+ import java.util.regex.Pattern;
+Index: gwt-debian.git/user/src/com/google/gwt/safehtml/shared/SafeHtmlHostedModeUtils.java
+===================================================================
+--- gwt-debian.git.orig/user/src/com/google/gwt/safehtml/shared/SafeHtmlHostedModeUtils.java 2011-09-05 10:29:36.022643018 +0200
++++ gwt-debian.git/user/src/com/google/gwt/safehtml/shared/SafeHtmlHostedModeUtils.java 2011-09-05 10:29:36.042643760 +0200
+@@ -17,9 +17,9 @@
+
+ import com.google.gwt.core.client.GWT;
+ import com.google.common.base.Preconditions;
+-import com.google.gwt.thirdparty.streamhtmlparser.HtmlParser;
+-import com.google.gwt.thirdparty.streamhtmlparser.HtmlParserFactory;
+-import com.google.gwt.thirdparty.streamhtmlparser.ParseException;
++import com.google.streamhtmlparser.HtmlParser;
++import com.google.streamhtmlparser.HtmlParserFactory;
++import com.google.streamhtmlparser.ParseException;
+
+ /**
+ * SafeHtml utilities whose implementation differs between Development and
Modified: gwt/trunk/debian/patches/series
===================================================================
--- gwt/trunk/debian/patches/series 2012-06-13 04:16:44 UTC (rev 217)
+++ gwt/trunk/debian/patches/series 2012-07-04 12:08:19 UTC (rev 218)
@@ -1,2 +1,9 @@
build.patch
+build-protobuf-class
exclude-tomcat.patch
+fix-protobuf-pkg-path
+fix-guava-pkg-path
+fix-streamhtmlparser-pkg-path
+use-json-simple
+build-tests
+build-with-jdt37
Added: gwt/trunk/debian/patches/use-json-simple
===================================================================
--- gwt/trunk/debian/patches/use-json-simple (rev 0)
+++ gwt/trunk/debian/patches/use-json-simple 2012-07-04 12:08:19 UTC (rev 218)
@@ -0,0 +1,372 @@
+Index: gwt-debian.git/user/build.xml
+===================================================================
+--- gwt-debian.git.orig/user/build.xml 2011-09-06 16:21:43.638141752 +0200
++++ gwt-debian.git/user/build.xml 2011-09-13 16:05:50.430141886 +0200
+@@ -65,7 +65,7 @@
+ <pathelement location="${htmlunit.jar}" />
+ <pathelement location="${htmlunit-core-js.jar}" />
+ <pathelement location="${flute.jar}" />
+- <pathelement location="${json.jar}" />
++ <pathelement location="${json-simple.jar}" />
+ <pathelement location="${geronimo-validation.jar}" />
+ <pathelement location="${hibernate-validator.jar}" />
+ <pathelement location="${gwt.dev.jar}" />
+Index: gwt-debian.git/user/src/com/google/web/bindery/requestfactory/vm/testing/UrlRequestTransport.java
+===================================================================
+--- gwt-debian.git.orig/user/src/com/google/web/bindery/requestfactory/vm/testing/UrlRequestTransport.java 2011-09-06 15:43:55.870144106 +0200
++++ gwt-debian.git/user/src/com/google/web/bindery/requestfactory/vm/testing/UrlRequestTransport.java 2011-09-13 16:43:23.393208365 +0200
+@@ -19,19 +19,22 @@
+ import com.google.web.bindery.requestfactory.shared.RequestTransport;
+ import com.google.web.bindery.requestfactory.shared.ServerFailure;
+
+-import org.json.Cookie;
+-import org.json.JSONException;
+-import org.json.JSONObject;
++import org.json.simple.JSONObject;
++import org.json.simple.parser.JSONParser;
++import org.json.simple.parser.ParseException;
+
+ import java.io.ByteArrayOutputStream;
+ import java.io.IOException;
+ import java.io.InputStream;
+ import java.io.OutputStream;
++import java.io.UnsupportedEncodingException;
+ import java.net.HttpURLConnection;
+ import java.net.URL;
++import java.net.URLDecoder;
+ import java.util.HashMap;
+ import java.util.List;
+ import java.util.Map;
++import java.util.StringTokenizer;
+ import java.util.zip.GZIPInputStream;
+ import java.util.zip.InflaterInputStream;
+
+@@ -76,6 +79,45 @@
+ return cookies;
+ }
+
++ private static String unescape(String escaped) throws ParseException {
++ try{
++ return URLDecoder.decode(escaped, "utf-8");
++ }catch(UnsupportedEncodingException e){
++ throw new ParseException(ParseException.ERROR_UNEXPECTED_TOKEN);
++ }
++ }
++
++ private static JSONObject parseCookie(String raw_cookie) throws ParseException {
++ JSONObject json = new JSONObject();
++
++ StringTokenizer parser = new StringTokenizer(raw_cookie, ";");
++
++ String token = parser.nextToken();
++ String[] namevalue = token.split("=", 2);
++ String name = unescape(namevalue[0]);
++ json.put("name", name);
++ String value = unescape(namevalue[1]);
++ json.put("value", value);
++
++ while(parser.hasMoreTokens()){
++ token = parser.nextToken();
++ namevalue = token.split("=", 2);
++ name = unescape(namevalue[0]);
++ if( name.equals("secure") ){
++ json.put("secure", new Boolean(true));
++ }else{
++ try{
++ value = unescape(namevalue[1]);
++ json.put(name, value);
++ }catch(ArrayIndexOutOfBoundsException e){
++ // "missing '='
++ throw new ParseException(ParseException.ERROR_UNEXPECTED_TOKEN);
++ }
++ }
++ }
++ return json;
++ }
++
+ @Override
+ public void send(String payload, TransportReceiver receiver) {
+ HttpURLConnection connection = null;
+@@ -96,19 +138,20 @@
+
+ List<String> cookieHeaders = connection.getHeaderFields().get("Set-Cookie");
+ if (cookieHeaders != null) {
++ JSONParser parser = new JSONParser();
+ for (String header : cookieHeaders) {
+ try {
+- JSONObject cookie = Cookie.toJSONObject(header);
+- String name = cookie.getString("name");
+- String value = cookie.getString("value");
+- String domain = cookie.optString("Domain");
++ JSONObject cookie = parseCookie(header);
++ String name = (String)cookie.get("name");
++ String value = (String)cookie.get("value");
++ String domain = (String)cookie.get("Domain");
+ if (domain == null || url.getHost().endsWith(domain)) {
+- String path = cookie.optString("Path");
++ String path = (String)cookie.get("Path");
+ if (path == null || url.getPath().startsWith(path)) {
+ cookies.put(name, value);
+ }
+ }
+- } catch (JSONException ignored) {
++ } catch (ParseException ignored) {
+ }
+ }
+ }
+Index: gwt-debian.git/user/src/com/google/web/bindery/autobean/shared/impl/StringQuoter.java
+===================================================================
+--- gwt-debian.git.orig/user/src/com/google/web/bindery/autobean/shared/impl/StringQuoter.java 2011-09-06 15:43:55.886143186 +0200
++++ gwt-debian.git/user/src/com/google/web/bindery/autobean/shared/impl/StringQuoter.java 2011-09-06 16:21:43.782143626 +0200
+@@ -18,7 +18,7 @@
+ import com.google.web.bindery.autobean.shared.Splittable;
+ import com.google.web.bindery.autobean.vm.impl.JsonSplittable;
+
+-import org.json.JSONObject;
++import org.json.simple.JSONValue;
+
+ import java.text.DateFormat;
+ import java.text.ParseException;
+@@ -66,7 +66,7 @@
+ * Create a quoted JSON string.
+ */
+ public static String quote(String raw) {
+- return JSONObject.quote(raw);
++ return JSONValue.escape(raw);
+ }
+
+ public static Splittable split(String payload) {
+Index: gwt-debian.git/user/src/com/google/web/bindery/autobean/vm/impl/JsonSplittable.java
+===================================================================
+--- gwt-debian.git.orig/user/src/com/google/web/bindery/autobean/vm/impl/JsonSplittable.java 2011-09-06 15:43:55.906143791 +0200
++++ gwt-debian.git/user/src/com/google/web/bindery/autobean/vm/impl/JsonSplittable.java 2011-09-13 16:34:12.818391717 +0200
+@@ -20,9 +20,10 @@
+ import com.google.web.bindery.autobean.shared.impl.HasSplittable;
+ import com.google.web.bindery.autobean.shared.impl.StringQuoter;
+
+-import org.json.JSONArray;
+-import org.json.JSONException;
+-import org.json.JSONObject;
++import org.json.simple.JSONValue;
++import org.json.simple.JSONObject;
++import org.json.simple.JSONArray;
++import org.json.simple.parser.ParseException;
+
+ import java.util.Arrays;
+ import java.util.Collections;
+@@ -44,11 +45,11 @@
+ try {
+ switch (payload.charAt(0)) {
+ case '{':
+- return new JsonSplittable(new JSONObject(payload));
++ return new JsonSplittable((JSONObject)JSONValue.parseWithException(payload));
+ case '[':
+- return new JsonSplittable(new JSONArray(payload));
++ return new JsonSplittable((JSONObject)JSONValue.parseWithException(payload));
+ case '"':
+- return new JsonSplittable(new JSONArray("[" + payload + "]").getString(0));
++ return new JsonSplittable((String)((JSONArray)JSONValue.parseWithException("[" + payload + "]")).get(0));
+ case '-':
+ case '0':
+ case '1':
+@@ -69,7 +70,7 @@
+ default:
+ throw new RuntimeException("Could not parse payload: payload[0] = " + payload.charAt(0));
+ }
+- } catch (JSONException e) {
++ } catch (ParseException e) {
+ throw new RuntimeException("Could not parse payload", e);
+ }
+ }
+@@ -87,12 +88,12 @@
+ * method is not available in Android 2.2. Used to represent a null value.
+ */
+ private static String[] getNames(JSONObject json) {
+- int length = json.length();
++ int length = json.size();
+ if (length == 0) {
+ return null;
+ }
+ String[] names = new String[length];
+- Iterator<?> i = json.keys();
++ Iterator<?> i = json.entrySet().iterator();
+ int j = 0;
+ while (i.hasNext()) {
+ names[j++] = (String) i.next();
+@@ -150,8 +151,8 @@
+
+ public void assign(Splittable parent, int index) {
+ try {
+- ((JsonSplittable) parent).array.put(index, value());
+- } catch (JSONException e) {
++ ((JsonSplittable) parent).array.add(index, value());
++ } catch (IllegalArgumentException e) {
+ throw new RuntimeException(e);
+ }
+ }
+@@ -159,7 +160,7 @@
+ public void assign(Splittable parent, String propertyName) {
+ try {
+ ((JsonSplittable) parent).obj.put(propertyName, value());
+- } catch (JSONException e) {
++ } catch (IllegalArgumentException e) {
+ throw new RuntimeException(e);
+ }
+ }
+@@ -175,7 +176,7 @@
+ public Splittable get(int index) {
+ try {
+ return makeSplittable(array.get(index));
+- } catch (JSONException e) {
++ } catch (IllegalArgumentException e) {
+ throw new RuntimeException(e);
+ }
+ }
+@@ -183,7 +184,7 @@
+ public Splittable get(String key) {
+ try {
+ return makeSplittable(obj.get(key));
+- } catch (JSONException e) {
++ } catch (IllegalArgumentException e) {
+ throw new RuntimeException(key, e);
+ }
+ }
+@@ -240,12 +241,12 @@
+ }
+
+ public boolean isNull(int index) {
+- return array.isNull(index);
++ return array.get(index) == null;
+ }
+
+ public boolean isNull(String key) {
+ // Treat undefined and null as the same
+- return !obj.has(key) || obj.isNull(key);
++ return !obj.containsKey(key) || obj.get(key) == null;
+ }
+
+ public boolean isNumber() {
+@@ -261,7 +262,7 @@
+ }
+
+ public boolean isUndefined(String key) {
+- return !obj.has(key);
++ return !obj.containsKey(key);
+ }
+
+ public void setReified(String key, Object object) {
+@@ -273,8 +274,8 @@
+ JSONArray newArray = new JSONArray();
+ for (int i = 0; i < size; i++) {
+ try {
+- newArray.put(i, array.get(i));
+- } catch (JSONException e) {
++ newArray.add(i, array.get(i));
++ } catch (IllegalArgumentException e) {
+ throw new RuntimeException(e);
+ }
+ }
+@@ -282,7 +283,7 @@
+ }
+
+ public int size() {
+- return array.length();
++ return array.size();
+ }
+
+ /**
+@@ -294,7 +295,7 @@
+ }
+
+ private synchronized JsonSplittable makeSplittable(Object object) {
+- if (JSONObject.NULL.equals(object)) {
++ if (object == null) {
+ return null;
+ }
+ /*
+Index: gwt-debian.git/user/src/com/google/gwt/logging/server/JsonLogRecordServerUtil.java
+===================================================================
+--- gwt-debian.git.orig/user/src/com/google/gwt/logging/server/JsonLogRecordServerUtil.java 2011-09-06 15:43:55.926143630 +0200
++++ gwt-debian.git/user/src/com/google/gwt/logging/server/JsonLogRecordServerUtil.java 2011-09-13 16:36:24.606142220 +0200
+@@ -16,9 +16,10 @@
+
+ package com.google.gwt.logging.server;
+
+-import org.json.JSONArray;
+-import org.json.JSONException;
+-import org.json.JSONObject;
++import org.json.simple.JSONValue;
++import org.json.simple.JSONArray;
++import org.json.simple.JSONObject;
++import org.json.simple.parser.ParseException;
+
+ import java.util.logging.Level;
+ import java.util.logging.LogRecord;
+@@ -36,14 +37,14 @@
+ private static Logger logger =
+ Logger.getLogger(JsonLogRecordServerUtil.class.getName());
+ public static LogRecord logRecordFromJson(String jsonString)
+- throws JSONException {
+- JSONObject lro = new JSONObject(jsonString);
+- String level = lro.getString("level");
+- String loggerName = lro.getString("loggerName");
+- String msg = lro.getString("msg");
+- long timestamp = Long.parseLong(lro.getString("timestamp"));
++ throws ParseException {
++ JSONObject lro = (JSONObject)JSONValue.parseWithException(jsonString);
++ String level = (String)lro.get("level");
++ String loggerName = (String)lro.get("loggerName");
++ String msg = (String)lro.get("msg");
++ long timestamp = Long.parseLong((String)lro.get("timestamp"));
+ Throwable thrown =
+- throwableFromJson(lro.getString("thrown"));
++ throwableFromJson((String)lro.get("thrown"));
+ LogRecord lr = new LogRecord(Level.parse(level), msg);
+ lr.setLoggerName(loggerName);
+ lr.setThrown(thrown);
+@@ -52,30 +53,30 @@
+ }
+
+ private static StackTraceElement stackTraceElementFromJson(
+- String jsonString) throws JSONException {
+- JSONObject ste = new JSONObject(jsonString);
+- String className = ste.getString("className");
+- String fileName = ste.getString("fileName");
+- String methodName = ste.getString("methodName");
+- int lineNumber = Integer.parseInt(ste.getString("lineNumber"));
++ String jsonString) throws ParseException {
++ JSONObject ste = (JSONObject)JSONValue.parseWithException(jsonString);
++ String className = (String)ste.get("className");
++ String fileName = (String)ste.get("fileName");
++ String methodName = (String)ste.get("methodName");
++ int lineNumber = Integer.parseInt((String)ste.get("lineNumber"));
+ return new StackTraceElement(className, methodName, fileName, lineNumber);
+ }
+
+ private static Throwable throwableFromJson(String jsonString)
+- throws JSONException {
++ throws ParseException {
+ if (jsonString.equals("{}")) {
+ return null;
+ }
+- JSONObject t = new JSONObject(jsonString);
+- String message = t.getString("message");
++ JSONObject t = (JSONObject)JSONValue.parseWithException(jsonString);
++ String message = (String)t.get("message");
+ Throwable cause =
+- throwableFromJson(t.getString("cause"));
++ throwableFromJson((String)t.get("cause"));
+ StackTraceElement[] stackTrace = null;
+- JSONArray st = t.getJSONArray("stackTrace");
+- if (st.length() > 0) {
+- stackTrace = new StackTraceElement[st.length()];
+- for (int i = 0; i < st.length(); i++) {
+- stackTrace[i] = stackTraceElementFromJson(st.getString(i));
++ JSONArray st = (JSONArray)t.get("stackTrace");
++ if (st.size() > 0) {
++ stackTrace = new StackTraceElement[st.size()];
++ for (int i = 0; i < st.size(); i++) {
++ stackTrace[i] = stackTraceElementFromJson((String)st.get(i));
+ }
+ }
+ Throwable thrown = new Throwable(message, cause);
Modified: gwt/trunk/debian/rules
===================================================================
--- gwt/trunk/debian/rules 2012-06-13 04:16:44 UTC (rev 217)
+++ gwt/trunk/debian/rules 2012-07-04 12:08:19 UTC (rev 218)
@@ -16,8 +16,8 @@
done
binary-post-install/libgwt-dev-java::
- dh_install -plibgwt-dev-java target/gwt-dev-linux-$(DEB_UPSTREAM_VERSION).jar usr/share/java
- dh_link -plibgwt-dev-java usr/share/java/gwt-dev-linux-$(DEB_UPSTREAM_VERSION).jar usr/share/java/gwt-dev-linux.jar
+ dh_install -plibgwt-dev-java target/gwt-dev-$(DEB_UPSTREAM_VERSION).jar usr/share/java
+ dh_link -plibgwt-dev-java usr/share/java/gwt-dev-$(DEB_UPSTREAM_VERSION).jar usr/share/java/gwt-dev.jar
get-orig-source:
debian/orig-tar.sh --upstream-version $(DEB_UPSTREAM_VERSION)
More information about the pkg-eucalyptus-commits
mailing list