Merge branch 'master' at M6 into 'OT_BETA_JAVA8'
+ fix compile errors in tests
diff --git a/features/org.eclipse.objectteams.otdt.core.patch/feature.xml b/features/org.eclipse.objectteams.otdt.core.patch/feature.xml
index 839b7cf..95bef1d 100644
--- a/features/org.eclipse.objectteams.otdt.core.patch/feature.xml
+++ b/features/org.eclipse.objectteams.otdt.core.patch/feature.xml
@@ -59,7 +59,7 @@
    </url>
 
    <requires>
-      <import feature="org.eclipse.jdt" version="3.9.0.v20121210-132935-8-8uFyYFNOfwKNWRqxYHNBDV3834" patch="true"/>
+      <import feature="org.eclipse.jdt" version="3.9.0.v20130314-1330" patch="true"/>
    </requires>
 
    <plugin
diff --git a/features/org.eclipse.objectteams.otdt.feature/feature.xml b/features/org.eclipse.objectteams.otdt.feature/feature.xml
index fd427fd..990cc94 100644
--- a/features/org.eclipse.objectteams.otdt.feature/feature.xml
+++ b/features/org.eclipse.objectteams.otdt.feature/feature.xml
@@ -58,7 +58,7 @@
    </license>
 
    <url>
-      <update label="Object Teams Updates" url="http://download.eclipse.org/objectteams/updates/2.1"/>
+      <update label="Object Teams Updates" url="http://download.eclipse.org/objectteams/updates/ot2.2"/>
       <discovery label="Object Teams Contributions" url="http://download.eclipse.org/objectteams/updates/contrib"/>
    </url>
 
diff --git a/features/org.eclipse.objectteams.otequinox.feature/feature.xml b/features/org.eclipse.objectteams.otequinox.feature/feature.xml
index 1609d3a..1d62208 100644
--- a/features/org.eclipse.objectteams.otequinox.feature/feature.xml
+++ b/features/org.eclipse.objectteams.otequinox.feature/feature.xml
@@ -21,7 +21,7 @@
    </license>
 
    <url>
-      <update label="Object Teams Updates" url="http://download.eclipse.org/objectteams/updates/2.1"/>
+      <update label="Object Teams Updates" url="http://download.eclipse.org/objectteams/updates/ot2.2"/>
       <discovery label="Orbit Repository" url="http://download.eclipse.org/tools/orbit/downloads/drops/R20100519200754/repository"/>
    </url>
 
diff --git a/org.eclipse.jdt.core.tests.compiler/pom.xml b/org.eclipse.jdt.core.tests.compiler/pom.xml
index 2d3a6d0..01c15c4 100644
--- a/org.eclipse.jdt.core.tests.compiler/pom.xml
+++ b/org.eclipse.jdt.core.tests.compiler/pom.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-  Copyright (c) 2012 Eclipse Foundation.
+  Copyright (c) 2012, 2013 Eclipse Foundation and others.
   All rights reserved. This program and the accompanying materials
   are made available under the terms of the Eclipse Distribution License v1.0
   which accompanies this distribution, and is available at
@@ -18,7 +18,7 @@
     <groupId>eclipse.jdt.core</groupId>
     <version>3.8.0-SNAPSHOT</version>
   </parent>
-  <groupId>eclipse.jdt.core</groupId>
+  <groupId>org.eclipse.jdt</groupId>
   <artifactId>org.eclipse.jdt.core.tests.compiler</artifactId>
   <version>3.8.2-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractComparableTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractComparableTest.java
index a371999..22685c1 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractComparableTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractComparableTest.java
@@ -7,6 +7,8 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Stephan Herrmann - Contribution for
+ *								bug 376590 - Private fields with @Inject are ignored by unused field validation
  *******************************************************************************/
 package org.eclipse.jdt.core.tests.compiler.regression;
 
@@ -15,6 +17,32 @@
 import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
 
 public class AbstractComparableTest extends AbstractRegressionTest {
+
+	protected static final String GOOGLE_INJECT_NAME = "com/google/inject/Inject.java";
+	protected static final String GOOGLE_INJECT_CONTENT = 
+		"package com.google.inject;\n" + 
+		"import static java.lang.annotation.ElementType.*;\n" + 
+		"import java.lang.annotation.Retention;\n" + 
+		"import static java.lang.annotation.RetentionPolicy.RUNTIME;\n" + 
+		"import java.lang.annotation.Target;\n" +
+		"@Target({ METHOD, CONSTRUCTOR, FIELD })\n" + 
+		"@Retention(RUNTIME)\n" + 
+		"public @interface Inject {\n" + 
+		"\n" + 
+		"  boolean optional() default false;\n" + 
+		"}";
+
+	protected static final String JAVAX_INJECT_NAME = "javax/inject/Inject.java";
+	protected static final String JAVAX_INJECT_CONTENT = 
+		"package javax.inject;\n" + 
+		"import static java.lang.annotation.ElementType.*;\n" + 
+		"import java.lang.annotation.Retention;\n" + 
+		"import static java.lang.annotation.RetentionPolicy.RUNTIME;\n" + 
+		"import java.lang.annotation.Target;\n" +
+		"@Target({ METHOD, CONSTRUCTOR, FIELD })\n" + 
+		"@Retention(RUNTIME)\n" + 
+		"public @interface Inject {}\n";
+
 	public static Test buildComparableTestSuite(Class evaluationTestClass) {
 		Test suite = buildMinimalComplianceTestSuite(evaluationTestClass, F_1_5);
 		TESTS_COUNTERS.put(evaluationTestClass.getName(), new Integer(suite.countTestCases()));
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
index 818dd72..39b40a3 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
@@ -17,6 +17,7 @@
  *								bug 388800 - [1.8] adjust tests to 1.8 JRE
  *								bug 402237 - [1.8][compiler] investigate differences between compilers re MethodVerifyTest
  *								bug 391376 - [1.8] check interaction of default methods with bridge methods and generics
+ *     Jesper S Moller - Contributions for bug 378674 - "The method can be declared as static" is wrong
  *******************************************************************************/
 package org.eclipse.jdt.core.tests.compiler.regression;
 
@@ -1373,6 +1374,28 @@
 			// javac options
 			JavacTestOptions.DEFAULT /* default javac test options */);
 	}
+	protected void runConformTest(String[] testFiles, Map customOptions) {
+		runTest(
+			// test directory preparation
+			true /* flush output directory */,
+			testFiles /* test files */,
+			// compiler options
+			null /* no class libraries */,
+			customOptions /* no custom options */,
+			false /* do not perform statements recovery */,
+			null /* no custom requestor */,
+			// compiler results
+			false /* expecting no compiler errors */,
+			null /* do not check compiler log */,
+			// runtime options
+			false /* do not force execution */,
+			null /* no vm arguments */,
+			// runtime results
+			null /* expected output string */,
+			null /* do not check error string */,
+			// javac options
+			JavacTestOptions.DEFAULT /* default javac test options */);
+	}
 	protected void runConformTest(
 			String[] testFiles,
 			String[] dependantFiles,
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java
index 62f1a23..c5b67e8 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java
@@ -18,6 +18,7 @@
  *								bug 384663 - Package Based Annotation Compilation Error in JDT 3.8/4.2 (works in 3.7.2) 
  *								bug 386356 - Type mismatch error with annotations and generics
  *								bug 331649 - [compiler][null] consider null annotations for fields
+ *								bug 376590 - Private fields with @Inject are ignored by unused field validation
  *     Jesper S Moller  - Contributions for
  *								bug 384567 - [1.5][compiler] Compiler accepts illegal modifiers on package declaration
  *******************************************************************************/
@@ -10584,6 +10585,119 @@
 		"----------\n",
 		JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
 }
+
+// https://bugs.eclipse.org/376590 - Private fields with @Inject are ignored by unused field validation
+// using com.google.inject.Inject
+public void testBug376590a() {
+	Map customOptions = getCompilerOptions();
+	customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
+	customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
+	this.runNegativeTest(
+		true,
+		new String[] {
+			GOOGLE_INJECT_NAME,
+			GOOGLE_INJECT_CONTENT,
+			"Example.java",
+			"import com.google.inject.Inject;\n" +
+			"class Example {\n" +
+			"  private @Inject Object o;\n" +
+			"  private @Inject Example() {}\n" + // no warning on constructor
+			"  public Example(Object o) { this.o = o; }\n" +
+			"  private @Inject void setO(Object o) { this.o = o;}\n" + // no warning on method
+			"}\n"
+		},
+		null, customOptions,
+		"----------\n" + 
+		"1. ERROR in Example.java (at line 3)\n" + 
+		"	private @Inject Object o;\n" + 
+		"	                       ^\n" + 
+		"The value of the field Example.o is not used\n" + 
+		"----------\n",
+		JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);	
+}
+// https://bugs.eclipse.org/376590 - Private fields with @Inject are ignored by unused field validation
+// using javax.inject.Inject - slight variation
+public void testBug376590b() {
+	Map customOptions = getCompilerOptions();
+	customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
+	customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
+	this.runNegativeTest(
+		true,
+		new String[] {
+			JAVAX_INJECT_NAME,
+			JAVAX_INJECT_CONTENT,
+			"Example.java",
+			"class Example {\n" +
+			"  private @javax.inject.Inject Object o;\n" +
+			"  private Example() {} // also warn here: no @Inject\n" +
+			"  public Example(Object o) { this.o = o; }\n" +
+			"  private @javax.inject.Inject void setO(Object o) { this.o = o;}\n" +
+			"}\n"
+		},
+		null, customOptions,
+		"----------\n" + 
+		"1. ERROR in Example.java (at line 2)\n" + 
+		"	private @javax.inject.Inject Object o;\n" + 
+		"	                                    ^\n" + 
+		"The value of the field Example.o is not used\n" + 
+		"----------\n" + 
+		"2. ERROR in Example.java (at line 3)\n" + 
+		"	private Example() {} // also warn here: no @Inject\n" + 
+		"	        ^^^^^^^^^\n" + 
+		"The constructor Example() is never used locally\n" + 
+		"----------\n",
+		JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);	
+}
+// https://bugs.eclipse.org/376590 - Private fields with @Inject are ignored by unused field validation
+// using javax.inject.Inject, combined with standard as well as custom annotations
+public void testBug376590c() {
+	Map customOptions = getCompilerOptions();
+	customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
+	customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
+	customOptions.put(CompilerOptions.OPTION_AnnotationBasedNullAnalysis, CompilerOptions.ENABLED);
+	customOptions.put(CompilerOptions.OPTION_NonNullAnnotationName, "p.NonNull");
+	this.runNegativeTest(
+		true,
+		new String[] {
+			JAVAX_INJECT_NAME,
+			JAVAX_INJECT_CONTENT,
+			"Example.java",
+			"import javax.inject.Inject;\n" +
+			"class Example {\n" +
+			"  private @Inject @p.NonNull Object o; // do warn, annotations don't signal a read\n" +
+			"  private @Deprecated @Inject String old; // do warn, annotations don't signal a read\n" +
+			"  private @Inject @p.Annot Object o2;\n" + // don't warn, custom annotation could imply a read access
+			"}\n",
+			"p/NonNull.java",
+			"package p;\n" +
+			"import static java.lang.annotation.ElementType.*;\n" +
+			"import java.lang.annotation.*;\n" +
+			"@Target({TYPE, METHOD,PARAMETER,LOCAL_VARIABLE,FIELD})\n" +
+			"public @interface NonNull {\n" +
+			"}",
+			"p/Annot.java",
+			"package p;\n" +
+			"import static java.lang.annotation.ElementType.*;\n" +
+			"import java.lang.annotation.*;\n" +
+			"@Target({TYPE, METHOD,PARAMETER,LOCAL_VARIABLE, CONSTRUCTOR, FIELD})\n" +
+			"public @interface Annot {\n" +
+			"}"
+		},
+		null, customOptions,
+		"----------\n" + 
+		"1. ERROR in Example.java (at line 3)\n" + 
+		"	private @Inject @p.NonNull Object o; // do warn, annotations don't signal a read\n" + 
+		"	                                  ^\n" + 
+		"The value of the field Example.o is not used\n" + 
+		"----------\n" + 
+		"2. ERROR in Example.java (at line 4)\n" + 
+		"	private @Deprecated @Inject String old; // do warn, annotations don't signal a read\n" + 
+		"	                                   ^^^\n" + 
+		"The value of the field Example.old is not used\n" + 
+		"----------\n",
+		JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);	
+}
+
 public void testBug376429a() {
 	this.runNegativeTest(
 			new String[] {
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java
index 93667c2..e9b0bcc 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java
@@ -30,6 +30,7 @@
  *								bug 402028 - [1.8][compiler] null analysis for reference expressions 
  *								bug 401796 - [1.8][compiler] don't treat default methods as overriding an independent inherited abstract method
  *								bug 404649 - [1.8][compiler] detect illegal reference to indirect or redundant super
+ *								bug 400761 - [compiler][null] null may be return as boolean without a diagnostic
  *     Jesper S Moller - Contributions for
  *								bug 382701 - [1.8][compiler] Implement semantic analysis of Lambda expressions & Reference expression
  *								bug 382721 - [1.8][compiler] Effectively final variables needs special treatment
@@ -817,12 +818,14 @@
 		expectedProblemAttributes.put("NotVisibleMethod", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
 		expectedProblemAttributes.put("NotVisibleType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
 		expectedProblemAttributes.put("NullableFieldReference", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
+		expectedProblemAttributes.put("NullExpressionReference", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
 		expectedProblemAttributes.put("NullLocalVariableComparisonYieldsFalse", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
 		expectedProblemAttributes.put("NullLocalVariableInstanceofYieldsFalse", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
 		expectedProblemAttributes.put("NullLocalVariableReference", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
 		expectedProblemAttributes.put("NullityMismatchingTypeAnnotation", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
 		expectedProblemAttributes.put("NullityMismatchingTypeAnnotationUnchecked", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
 		expectedProblemAttributes.put("NullSourceString", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
+		expectedProblemAttributes.put("NullUnboxing", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
 		expectedProblemAttributes.put("NumericValueOutOfRange", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
 		expectedProblemAttributes.put("ObjectCannotBeGeneric", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
 		expectedProblemAttributes.put("ObjectCannotHaveSuperTypes", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
@@ -864,7 +867,9 @@
 		expectedProblemAttributes.put("PotentiallyUnclosedCloseable", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
 		expectedProblemAttributes.put("PotentiallyUnclosedCloseableAtExit", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
 		expectedProblemAttributes.put("PotentialNullLocalVariableReference", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
+		expectedProblemAttributes.put("PotentialNullExpressionReference", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
 		expectedProblemAttributes.put("PotentialNullMessageSendReference", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
+		expectedProblemAttributes.put("PotentialNullUnboxing", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
 		expectedProblemAttributes.put("PublicClassMustMatchFileName", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
 		expectedProblemAttributes.put("RawMemberTypeCannotBeParameterized", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
 		expectedProblemAttributes.put("RawTypeReference", new ProblemAttributes(CategorizedProblem.CAT_UNCHECKED_RAW));
@@ -1677,12 +1682,14 @@
 		expectedProblemAttributes.put("NotVisibleMethod", SKIP);
 		expectedProblemAttributes.put("NotVisibleType", SKIP);
 		expectedProblemAttributes.put("NullableFieldReference", new ProblemAttributes(JavaCore.COMPILER_PB_NULL_REFERENCE));
+		expectedProblemAttributes.put("NullExpressionReference", new ProblemAttributes(JavaCore.COMPILER_PB_NULL_REFERENCE));
 		expectedProblemAttributes.put("NullityMismatchingTypeAnnotation", new ProblemAttributes(JavaCore.COMPILER_PB_NULL_SPECIFICATION_VIOLATION));
 		expectedProblemAttributes.put("NullityMismatchingTypeAnnotationUnchecked", new ProblemAttributes(JavaCore.COMPILER_PB_NULL_UNCHECKED_CONVERSION));
 		expectedProblemAttributes.put("NullLocalVariableComparisonYieldsFalse", new ProblemAttributes(JavaCore.COMPILER_PB_REDUNDANT_NULL_CHECK));
 		expectedProblemAttributes.put("NullLocalVariableInstanceofYieldsFalse", new ProblemAttributes(JavaCore.COMPILER_PB_REDUNDANT_NULL_CHECK));
 		expectedProblemAttributes.put("NullLocalVariableReference", new ProblemAttributes(JavaCore.COMPILER_PB_NULL_REFERENCE));
 		expectedProblemAttributes.put("NullSourceString", SKIP);
+		expectedProblemAttributes.put("NullUnboxing", new ProblemAttributes(JavaCore.COMPILER_PB_NULL_REFERENCE));
 		expectedProblemAttributes.put("NumericValueOutOfRange", SKIP);
 		expectedProblemAttributes.put("ObjectCannotBeGeneric", SKIP);
 		expectedProblemAttributes.put("ObjectCannotHaveSuperTypes", SKIP);
@@ -1723,7 +1730,9 @@
 		expectedProblemAttributes.put("PotentialHeapPollutionFromVararg", new ProblemAttributes(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION));
 		expectedProblemAttributes.put("PotentiallyUnclosedCloseable", new ProblemAttributes(JavaCore.COMPILER_PB_POTENTIALLY_UNCLOSED_CLOSEABLE));
 		expectedProblemAttributes.put("PotentiallyUnclosedCloseableAtExit", new ProblemAttributes(JavaCore.COMPILER_PB_POTENTIALLY_UNCLOSED_CLOSEABLE));
+		expectedProblemAttributes.put("PotentialNullExpressionReference", new ProblemAttributes(JavaCore.COMPILER_PB_POTENTIAL_NULL_REFERENCE));
 		expectedProblemAttributes.put("PotentialNullLocalVariableReference", new ProblemAttributes(JavaCore.COMPILER_PB_POTENTIAL_NULL_REFERENCE));
+		expectedProblemAttributes.put("PotentialNullUnboxing", new ProblemAttributes(JavaCore.COMPILER_PB_POTENTIAL_NULL_REFERENCE));
 		expectedProblemAttributes.put("PotentialNullMessageSendReference", new ProblemAttributes(JavaCore.COMPILER_PB_POTENTIAL_NULL_REFERENCE));
 		expectedProblemAttributes.put("PublicClassMustMatchFileName", SKIP);
 		expectedProblemAttributes.put("RawMemberTypeCannotBeParameterized", SKIP);
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ForeachStatementTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ForeachStatementTest.java
index 3f4ff0d..f78b826 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ForeachStatementTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ForeachStatementTest.java
@@ -14,6 +14,8 @@
  *     Stephan Herrmann - Contribution for
  *								bug 393719 - [compiler] inconsistent warnings on iteration variables
  *								Bug 388800 - [1.8] adjust tests to 1.8 JRE
+ *     Jesper S Moller -  Contribution for
+ *								bug 401853 - Eclipse Java compiler creates invalid bytecode (java.lang.VerifyError)
  *******************************************************************************/
 package org.eclipse.jdt.core.tests.compiler.regression;
 
@@ -2919,6 +2921,81 @@
 			"Zork cannot be resolved to a type\n" + 
 			"----------\n");
 }
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=401853
+// Eclipse Java compiler creates invalid bytecode (java.lang.VerifyError)
+public void test057() throws Exception {
+	Map options = getCompilerOptions();
+	options.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
+
+	this.runConformTest(
+		new String[] {
+			"X.java",
+			"import java.util.ArrayList;\n" + 
+			"\n" + 
+			"public class X {\n" + 
+			"	public static void main(String[] argv) {\n" + 
+			"		for (long l : new ArrayList<Long>()) {}\n" + 
+			"	}\n" + 
+			"}",
+		},
+		"",
+		null,
+		true,
+		null,
+		options,
+		null);
+
+	String expectedOutput =
+		"public class X {\n" + 
+		"  \n" + 
+		"  // Method descriptor #6 ()V\n" + 
+		"  // Stack: 1, Locals: 1\n" + 
+		"  public X();\n" + 
+		"    0  aload_0 [this]\n" + 
+		"    1  invokespecial java.lang.Object() [8]\n" + 
+		"    4  return\n" + 
+		"      Line numbers:\n" + 
+		"        [pc: 0, line: 3]\n" + 
+		"      Local variable table:\n" + 
+		"        [pc: 0, pc: 5] local: this index: 0 type: X\n" + 
+		"  \n" + 
+		"  // Method descriptor #15 ([Ljava/lang/String;)V\n" + 
+		"  // Stack: 2, Locals: 2\n" + 
+		"  public static void main(java.lang.String[] argv);\n" + 
+		"     0  new java.util.ArrayList [16]\n" + 
+		"     3  dup\n" + 
+		"     4  invokespecial java.util.ArrayList() [18]\n" + 
+		"     7  invokevirtual java.util.ArrayList.iterator() : java.util.Iterator [19]\n" + 
+		"    10  astore_1\n" + 
+		"    11  goto 27\n" + 
+		"    14  aload_1\n" + 
+		"    15  invokeinterface java.util.Iterator.next() : java.lang.Object [23] [nargs: 1]\n" + 
+		"    20  checkcast java.lang.Long [29]\n" + 
+		"    23  invokevirtual java.lang.Long.longValue() : long [31]\n" + 
+		"    26  pop2\n" + 
+		"    27  aload_1\n" + 
+		"    28  invokeinterface java.util.Iterator.hasNext() : boolean [35] [nargs: 1]\n" + 
+		"    33  ifne 14\n" + 
+		"    36  return\n" + 
+		"      Line numbers:\n" + 
+		"        [pc: 0, line: 5]\n" + 
+		"        [pc: 36, line: 6]\n" + 
+		"      Local variable table:\n" + 
+		"        [pc: 0, pc: 37] local: argv index: 0 type: java.lang.String[]\n";
+
+	File f = new File(OUTPUT_DIR + File.separator + "X.class");
+	byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
+	ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
+	String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
+	int index = result.indexOf(expectedOutput);
+	if (index == -1 || expectedOutput.length() == 0) {
+		System.out.println(Util.displayString(result, 3));
+	}
+	if (index == -1) {
+		assertEquals("Wrong contents", expectedOutput, result);
+	}
+}
+
 public static Class testClass() {
 	return ForeachStatementTest.class;
 }
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java
index f2c7f0a..78b77d4 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java
@@ -38795,8 +38795,7 @@
 			"		X myThing = new X<Object>();\n" +
 			"		Integer i = myThing.getList().get(0); // Type Mismatch error - Since\n" +
 			"												// myThing is unbounded, return\n" +
-			"												// type List<Integer>\n" +
-			"												// incorrectly becomes unbounded\n" +
+			"												// type List<Integer> becomes unbounded\n" +
 			"	}\n" +
 			"\n" +
 			"	public List<Integer> getList() {\n" +
@@ -38828,12 +38827,12 @@
 		"	            ^^^^^^^^^^^^^^^^^^^^^^^^\n" +
 		"Type mismatch: cannot convert from Object to Integer\n" +
 		"----------\n" +
-		"3. WARNING in X.java (at line 25)\n" +
+		"3. WARNING in X.java (at line 24)\n" +
 		"	X myThing = new X<Object>();\n" +
 		"	^\n" +
 		"X is a raw type. References to generic type X<T> should be parameterized\n" +
 		"----------\n" +
-		"4. WARNING in X.java (at line 26)\n" +
+		"4. WARNING in X.java (at line 25)\n" +
 		"	List<Integer> l = myThing.getList();\n" +
 		"	                  ^^^^^^^^^^^^^^^^^\n" +
 		"Type safety: The expression of type List needs unchecked conversion to conform to List<Integer>\n" +
@@ -51068,4 +51067,4 @@
 		"The constructor X.Base<X<T>.Arr>(Class<X.Arr>) is undefined\n" + 
 		"----------\n");
 }
-}
\ No newline at end of file
+}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java
index 8721046..6b769eb 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java
@@ -10,6 +10,7 @@
  *     Stephan Herrmann <stephan@cs.tu-berlin.de> - Contributions for
  *								bug 282152 - [1.5][compiler] Generics code rejected by Eclipse but accepted by javac
  *								bug 395002 - Self bound generic class doesn't resolve bounds properly for wildcards for certain parametrisation.
+ *								bug 401456 - Code compiles from javac/intellij, but fails from eclipse
  *******************************************************************************/
 package org.eclipse.jdt.core.tests.compiler.regression;
 
@@ -30,7 +31,7 @@
 	// Static initializer to specify tests subset using TESTS_* static variables
 	// All specified tests which does not belong to the class are skipped...
 	static {
-//		TESTS_NAMES = new String[] { "testBug395002_combined" };
+//		TESTS_NAMES = new String[] { "test401456" };
 //		TESTS_NAMES = new String[] { "test1464" };
 //		TESTS_NUMBERS = new int[] { 1465 };
 //		TESTS_RANGE = new int[] { 1097, -1 };
@@ -2817,4 +2818,43 @@
 		"----------\n",
 		null, true, customOptions);
 }
+// Bug 401456 - Code compiles from javac/intellij, but fails from eclipse
+public void test401456() {
+	runConformTest(
+		new String[] {
+			"App.java",
+			"import java.util.List;\n" +
+			"\n" +
+			"public class App {\n" +
+			"\n" +
+			"    public interface Command_1<T> {\n" +
+			"        public void execute(T o);\n" +
+			"    }\n" +
+			"    public static class ObservableEventWithArg<T> {\n" +
+			"        public class Monitor {\n" +
+			"            public Object addListener(final Command_1<T> l) {\n" +
+			"                return null;\n" +
+			"            }\n" +
+			"        }\n" +
+			"    }\n" +
+			"    public static class Context<T> {\n" +
+			"          public ObservableEventWithArg<String>.Monitor getSubmissionErrorEventMonitor() {\n" +
+			"              return new ObservableEventWithArg<String>().new Monitor();\n" +
+			"        }\n" +
+			"    }\n" +
+			"\n" +
+			"    public static void main(String[] args) {\n" +
+			"        compileError(new Context<List<String>>());\n" +
+			"    }\n" +
+			"\n" +
+			"    private static void compileError(Context context) {\n" +
+			"        context.getSubmissionErrorEventMonitor().addListener(\n" + // here the inner message send bogusly resolved to ObservableEventWithArg#RAW.Monitor
+			"            new Command_1<String>() {\n" +
+			"                public void execute(String o) {\n" +
+			"                }\n" +
+			"            });\n" +
+			"    }\n" +
+			"}\n"
+		});
+}
 }
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java
index 30cef27..a05f011 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010, 2012 GK Software AG and others.
+ * Copyright (c) 2010, 2013 GK Software AG 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
@@ -28,7 +28,7 @@
 // Static initializer to specify tests subset using TESTS_* static variables
 // All specified tests which do not belong to the class are skipped...
 static {
-//		TESTS_NAMES = new String[] { "test_nullable_field_10e" };
+//		TESTS_NAMES = new String[] { "test_conditional_expression" };
 //		TESTS_NUMBERS = new int[] { 561 };
 //		TESTS_RANGE = new int[] { 1, 2049 };
 }
@@ -4145,6 +4145,87 @@
 		"");
 }
 
+// A @NonNull field is assumed to be initialized by the injection framework
+// [compiler] Null analysis for fields does not take @com.google.inject.Inject into account
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=400421
+public void test_nonnull_field_15() {
+	runConformTestWithLibs(
+		new String[] {
+			GOOGLE_INJECT_NAME,
+			GOOGLE_INJECT_CONTENT,
+			"X.java",
+			"import org.eclipse.jdt.annotation.*;\n" +
+			"import com.google.inject.Inject;\n" +
+			"public class X {\n" +
+			"    @NonNull @Inject Object o;\n" +
+			"    @NonNullByDefault class Inner {\n" +
+			"        @Inject String s;\n" +
+			"    }\n" +
+			"}\n",
+		},
+		null /*customOptions*/,
+		"");
+}
+
+// Injection is optional, don't rely on the framework
+// [compiler] Null analysis for fields does not take @com.google.inject.Inject into account
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=400421
+public void test_nonnull_field_16() {
+	runNegativeTestWithLibs(
+		new String[] {
+			GOOGLE_INJECT_NAME,
+			GOOGLE_INJECT_CONTENT,
+			"X.java",
+			"import org.eclipse.jdt.annotation.*;\n" +
+			"import com.google.inject.Inject;\n" +
+			"public class X {\n" +
+			"    @Inject(optional=true) @NonNull Object o;\n" +
+			"    @NonNullByDefault class Inner {\n" +
+			"        @Inject(optional=true) String s;\n" +
+			"        @Inject(optional=false) String t;\n" + // don't complain here
+			"    }\n" +
+			"}\n",
+		},
+		null /*customOptions*/,
+		"----------\n" + 
+		"1. ERROR in X.java (at line 4)\n" + 
+		"	@Inject(optional=true) @NonNull Object o;\n" + 
+		"	                                       ^\n" + 
+		"The @NonNull field o may not have been initialized\n" + 
+		"----------\n" + 
+		"2. ERROR in X.java (at line 6)\n" + 
+		"	@Inject(optional=true) String s;\n" + 
+		"	                              ^\n" + 
+		"The @NonNull field s may not have been initialized\n" + 
+		"----------\n");
+}
+
+// Using javax.inject.Inject, slight variations
+// [compiler] Null analysis for fields does not take @com.google.inject.Inject into account
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=400421
+public void test_nonnull_field_17() {
+	runNegativeTestWithLibs(
+		new String[] {
+			JAVAX_INJECT_NAME,
+			JAVAX_INJECT_CONTENT,
+			"X.java",
+			"import org.eclipse.jdt.annotation.*;\n" +
+			"import javax.inject.Inject;\n" +
+			"public class X {\n" +
+			"    @NonNull @Inject static String s; // warn since injection of static field is less reliable\n" + // variation: static field
+			"    @NonNull @Inject @Deprecated Object o;\n" +
+			"    public X() {}\n" + // variation: with explicit constructor
+			"}\n",
+		},
+		null /*customOptions*/,
+		"----------\n" + 
+		"1. ERROR in X.java (at line 4)\n" + 
+		"	@NonNull @Inject static String s; // warn since injection of static field is less reliable\n" + 
+		"	                               ^\n" + 
+		"The @NonNull field s may not have been initialized\n" + 
+		"----------\n");
+}
+
 // access to a nullable field - field reference
 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=331649
 public void test_nullable_field_1() {
@@ -4902,6 +4983,44 @@
 		"----------\n");
 }
 
+// https://bugs.eclipse.org/401017: [compiler][null] casted reference to @Nullable field lacks a warning
+public void test_nullable_field_15() {
+	runNegativeTestWithLibs(
+		new String[] {
+			"X.java",
+			"import org.eclipse.jdt.annotation.*;\n" +
+			"public class X {\n" +
+			"    @Nullable\n" + 
+			"    private Object nullable;\n" + 
+			"\n" + 
+			"    public void test() {\n" + 
+			"        if (nullable instanceof Number) {\n" + 
+			"            ((Number)nullable).intValue(); // A\n" + 
+			"        }\n" + 
+			"        if (nullable != null) {\n" + 
+			"            nullable.toString(); // B\n" + 
+			"        }\n" + 
+			"        nullable.toString(); // C\n" + 
+			"    }\n" +
+			"}\n"
+		},
+		"----------\n" + 
+		"1. ERROR in X.java (at line 8)\n" + 
+		"	((Number)nullable).intValue(); // A\n" + 
+		"	         ^^^^^^^^\n" + 
+		"Potential null pointer access: The field nullable is declared as @Nullable\n" + 
+		"----------\n" + 
+		"2. ERROR in X.java (at line 11)\n" + 
+		"	nullable.toString(); // B\n" + 
+		"	^^^^^^^^\n" + 
+		"Potential null pointer access: The field nullable is declared as @Nullable\n" + 
+		"----------\n" + 
+		"3. ERROR in X.java (at line 13)\n" + 
+		"	nullable.toString(); // C\n" + 
+		"	^^^^^^^^\n" + 
+		"Potential null pointer access: The field nullable is declared as @Nullable\n" + 
+		"----------\n");
+}
 // an enum is declared within the scope of a null-default
 // https://bugs.eclipse.org/331649#c61
 public void test_enum_field_01() {
@@ -5783,4 +5902,111 @@
 		"Null type mismatch: required \'@NonNull Object\' but the provided value is null\n" + 
 		"----------\n"); 
 }
+// https://bugs.eclipse.org/382069 - [null] Make the null analysis consider JUnit's assertNotNull similarly to assertions
+// junit's assertNull vs. a @NonNull field / expression
+public void testBug382069_j() {
+	Map options = getCompilerOptions();
+	options.put(JavaCore.COMPILER_PB_DEAD_CODE, JavaCore.ERROR);
+	runNegativeTestWithLibs(
+		new String[] {
+			NullReferenceTestAsserts.JUNIT_ASSERT_NAME,
+			NullReferenceTestAsserts.JUNIT_ASSERT_CONTENT,		
+			"X.java",
+			"import org.eclipse.jdt.annotation.NonNull;\n" +
+			"public class X {\n" +
+			"  @NonNull String o1 = \"\";\n" +
+			"  boolean foo() {\n" +
+			"    junit.framework.Assert.assertNull(\"something's wrong\", o1);\n" + // always fails due to @NonNull
+			"    return false; // dead code\n" +
+			"  }\n" +
+			"  void bar() {\n" +
+			"      junit.framework.Assert.assertNull(\"\");\n" + // constantly false
+			"      return; // dead code\n" +
+			"  }\n" +
+			"  void zork() {\n" +
+			"      junit.framework.Assert.assertNotNull(null);\n" + // constantly false
+			"      return; // dead code\n" +
+			"  }\n" +
+			"}\n"},
+			options,
+			"----------\n" + 
+			"1. ERROR in X.java (at line 6)\n" + 
+			"	return false; // dead code\n" + 
+			"	^^^^^^^^^^^^^\n" + 
+			"Dead code\n" + 
+			"----------\n" + 
+			"2. ERROR in X.java (at line 10)\n" + 
+			"	return; // dead code\n" + 
+			"	^^^^^^^\n" + 
+			"Dead code\n" + 
+			"----------\n" + 
+			"3. ERROR in X.java (at line 14)\n" + 
+			"	return; // dead code\n" + 
+			"	^^^^^^^\n" + 
+			"Dead code\n" + 
+			"----------\n");
+}
+
+// https://bugs.eclipse.org/382069 - [null] Make the null analysis consider JUnit's assertNotNull similarly to assertions
+// junit's assertNonNull et al. affecting a @Nullable field using syntactic analysis
+public void testBug382069_k() {
+	Map options = getCompilerOptions();
+	options.put(JavaCore.COMPILER_PB_SYNTACTIC_NULL_ANALYSIS_FOR_FIELDS, JavaCore.ENABLED);
+	options.put(JavaCore.COMPILER_PB_DEAD_CODE, JavaCore.ERROR);
+	runNegativeTestWithLibs(
+		new String[] {
+			NullReferenceTestAsserts.JUNIT_ASSERT_NAME,
+			NullReferenceTestAsserts.JUNIT_ASSERT_CONTENT,		
+			"X.java",
+			"import org.eclipse.jdt.annotation.Nullable;\n" +
+			"public class X {\n" +
+			"  @Nullable String o1;\n" +
+			"  int foo() {\n" +
+			"    junit.framework.Assert.assertNotNull(\"something's wrong\", o1);\n" +
+			"    return o1.length();\n" +
+			"  }\n" +
+			"  int bar(int i) {\n" +
+			"    junit.framework.Assert.assertNotNull(o1);\n" +
+			"    i++;\n" + // expire
+			"    return o1.length(); // no longer protected\n" +
+			"  }\n" +
+			"  int garp() {\n" +
+			"    junit.framework.Assert.assertFalse(\"something's wrong\", o1 == null);\n" +
+			"    return o1.length();\n" +
+			"  }\n" +
+			"  int zipp() {\n" +
+			"    junit.framework.Assert.assertTrue(\"something's wrong\", o1 != null);\n" +
+			"    return o1.length();\n" +
+			"  }\n" +
+			"}\n"},
+			options,
+			"----------\n" + 
+			"1. ERROR in X.java (at line 11)\n" + 
+			"	return o1.length(); // no longer protected\n" + 
+			"	       ^^\n" + 
+			"Potential null pointer access: The field o1 is declared as @Nullable\n" + 
+			"----------\n");
+}
+//https://bugs.eclipse.org/400761: [compiler][null] null may be return as boolean without a diagnostic
+public void test_conditional_expression_1() {
+	runNegativeTestWithLibs(
+		new String[] {
+			"X.java",
+			"import org.eclipse.jdt.annotation.*;\n" +
+			"public class X {\n" +
+			"	boolean badFunction5(int i) {\n" + 
+			"		// expected a potential null problem:\n" + 
+			"		return i > 0 ? true : getBoolean();\n" + 
+			"	}\n" +
+			"	private @Nullable Boolean getBoolean() {\n" + 
+			"		return null;\n" + 
+			"	}\n" +
+			"}\n"},
+		"----------\n" + 
+		"1. ERROR in X.java (at line 5)\n" + 
+		"	return i > 0 ? true : getBoolean();\n" + 
+		"	                      ^^^^^^^^^^^^\n" + 
+		"Potential null pointer access: This expression of type Boolean may be null but requires auto-unboxing\n" + 
+		"----------\n");
+}
 }
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java
index 6245e57..5346099 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2012 IBM Corporation and others.
+ * Copyright (c) 2005, 2013 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
@@ -27,6 +27,9 @@
  *							bug 376263 - Bogus "Potential null pointer access" warning
  *							bug 331649 - [compiler][null] consider null annotations for fields
  *							bug 382789 - [compiler][null] warn when syntactically-nonnull expression is compared against null
+ *							bug 401088 - [compiler][null] Wrong warning "Redundant null check" inside nested try statement
+ *							bug 401092 - [compiler][null] Wrong warning "Redundant null check" in outer catch of nested try
+ *							bug 400761 - [compiler][null] null may be return as boolean without a diagnostic
  *******************************************************************************/
 package org.eclipse.jdt.core.tests.compiler.regression;
 
@@ -55,9 +58,9 @@
 // Only the highest compliance level is run; add the VM argument
 // -Dcompliance=1.4 (for example) to lower it if needed
 static {
-//		TESTS_NAMES = new String[] { "testBug345305_14" };
+//		TESTS_NAMES = new String[] { "test0037_conditional_expression" };
 //		TESTS_NAMES = new String[] { "test0515_try_finally" };
-//		TESTS_NAMES = new String[] { "testBug376263" };
+//		TESTS_NAMES = new String[] { "testBug319201c" };
 //		TESTS_NUMBERS = new int[] { 561 };
 //		TESTS_RANGE = new int[] { 1, 2049 };
 }
@@ -886,6 +889,141 @@
 	    JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
 }
 
+// https://bugs.eclipse.org/400761: [compiler][null] null may be return as boolean without a diagnostic
+public void test0037_conditional_expression_1() {
+	if (this.complianceLevel < ClassFileConstants.JDK1_5) return; // needs autoboxing
+	runNegativeTest(
+		new String[] {
+			"X.java",
+			"public class X {\n" +
+			"	boolean badFunction(int i) {\n" + 
+			"		return i > 0 ? true : null;\n" + 
+			"	}\n" +
+			"}\n"},
+		"----------\n" + 
+		"1. ERROR in X.java (at line 3)\n" + 
+		"	return i > 0 ? true : null;\n" + 
+		"	       ^^^^^^^^^^^^^^^^^^^\n" + 
+		"Potential null pointer access: This expression of type Boolean may be null but requires auto-unboxing\n" + 
+		"----------\n",
+	    JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
+}
+// https://bugs.eclipse.org/400761: [compiler][null] null may be return as boolean without a diagnostic
+public void test0037_conditional_expression_2() {
+	if (this.complianceLevel < ClassFileConstants.JDK1_5) return; // needs autoboxing
+	Map options = getCompilerOptions();
+	options.put(JavaCore.COMPILER_PB_SUPPRESS_OPTIONAL_ERRORS, JavaCore.ENABLED);
+	runNegativeTest(
+		true,
+		new String[] {
+			"X.java",
+			"public class X {\n" +
+			"	int badFunction(int i) {\n" +
+			"		return i > 0 ? null : Integer.MIN_VALUE;\n" +
+			"	}\n" +
+			"	@SuppressWarnings(\"null\")\n" +
+			"	int silent(int i) {\n" +
+			"		return i > 0 ? null : Integer.MIN_VALUE;\n" +
+			"	}\n" +
+			"}\n"},
+		null,
+		options,
+		"----------\n" + 
+		"1. ERROR in X.java (at line 3)\n" + 
+		"	return i > 0 ? null : Integer.MIN_VALUE;\n" + 
+		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
+		"Potential null pointer access: This expression of type Integer may be null but requires auto-unboxing\n" + 
+		"----------\n",
+	    JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
+}
+//https://bugs.eclipse.org/400761: [compiler][null] null may be return as boolean without a diagnostic
+public void test0037_conditional_expression_3() {
+	if (this.complianceLevel < ClassFileConstants.JDK1_5) return; // needs autoboxing
+	Map options = getCompilerOptions();
+	options.put(JavaCore.COMPILER_PB_POTENTIAL_NULL_REFERENCE, JavaCore.ERROR);
+	runNegativeTest(
+		true,
+		new String[] {
+			"X.java",
+			"public class X {\n" +
+			"	boolean badFunction3(int i) {\n" + 
+			"		//expected a potential null problem:\n" + 
+			"		return i > 0 ? true : (Boolean) null;\n" + 
+			"	}\n" +
+			"}\n"},
+		null,
+		options,
+		"----------\n" + 
+		"1. ERROR in X.java (at line 4)\n" + 
+		"	return i > 0 ? true : (Boolean) null;\n" + 
+		"	                      ^^^^^^^^^^^^^^\n" + 
+		"Null pointer access: This expression of type Boolean is null but requires auto-unboxing\n" + 
+		"----------\n",
+	    JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
+}
+// https://bugs.eclipse.org/400761: [compiler][null] null may be return as boolean without a diagnostic
+// if-then-else instead of conditional expression
+public void test0037_conditional_expression_4() {
+	if (this.complianceLevel < ClassFileConstants.JDK1_5) return; // needs autoboxing
+	Map options = getCompilerOptions();
+	options.put(JavaCore.COMPILER_PB_POTENTIAL_NULL_REFERENCE, JavaCore.ERROR);
+	options.put(JavaCore.COMPILER_PB_UNNECESSARY_ELSE, JavaCore.IGNORE);
+	runNegativeTest(
+		true,
+		new String[] {
+			"X.java",
+			"public class X {\n" +
+			"	boolean badFunction4(int i) {\n" + 
+			"	if (i > 0)\n" + 
+			"		return true;\n" + 
+			"	else\n" + 
+			"		// expected a null problem:\n" + 
+			"		return (Boolean) null;\n" + 
+			"	}\n" +
+			"}\n"},
+		null,
+		options,
+		"----------\n" + 
+		"1. ERROR in X.java (at line 7)\n" + 
+		"	return (Boolean) null;\n" + 
+		"	       ^^^^^^^^^^^^^^\n" + 
+		"Null pointer access: This expression of type Boolean is null but requires auto-unboxing\n" + 
+		"----------\n",
+	    JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
+}
+// https://bugs.eclipse.org/400761: [compiler][null] null may be return as boolean without a diagnostic
+// pot-null cond-expr in receiver position
+public void test0037_conditional_expression_5() {
+	Map options = getCompilerOptions();
+	options.put(JavaCore.COMPILER_PB_POTENTIAL_NULL_REFERENCE, JavaCore.ERROR);
+	runNegativeTest(
+		true,
+		new String[] {
+			"X.java",
+			"public class X {\n" +
+			"	String badFunction3(int i) {\n" + 
+			"		return (i > 0 ? this : null).toString();\n" + 
+			"	}\n" +
+			"	String badFunction4(int i) {\n" +
+			"		Object o = null;\n" + 
+			"		return (i > 0 ? o : null).toString();\n" + 
+			"	}\n" +
+			"}\n"},
+		null,
+		options,
+		"----------\n" + 
+		"1. ERROR in X.java (at line 3)\n" + 
+		"	return (i > 0 ? this : null).toString();\n" + 
+		"	       ^^^^^^^^^^^^^^^^^^^^^\n" + 
+		"Potential null pointer access: This expression may be null\n" + 
+		"----------\n" + 
+		"2. ERROR in X.java (at line 7)\n" + 
+		"	return (i > 0 ? o : null).toString();\n" + 
+		"	       ^^^^^^^^^^^^^^^^^^\n" + 
+		"Null pointer access: This expression can only be null\n" + 
+		"----------\n",
+	    JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
+}
 // null analysis -- autoboxing
 public void test0040_autoboxing_compound_assignment() {
 	if (this.complianceLevel >= ClassFileConstants.JDK1_5) {
@@ -902,7 +1040,7 @@
 			"1. ERROR in X.java (at line 4)\n" +
 			"	i += 1;\n" +
 			"	^\n" +
-			"Null pointer access: The variable i can only be null at this location\n" +
+			"Null pointer access: This expression of type Integer is null but requires auto-unboxing\n" +
 			"----------\n",
 		    JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
 	}
@@ -925,7 +1063,7 @@
 			"1. ERROR in X.java (at line 4)\n" +
 			"	i++;\n" +
 			"	^\n" +
-			"Null pointer access: The variable i can only be null at this location\n" +
+			"Null pointer access: This expression of type Integer is null but requires auto-unboxing\n" +
 			"----------\n",
 		    JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
 	}
@@ -974,7 +1112,7 @@
 			"1. ERROR in X.java (at line 4)\n" +
 			"	System.out.println(i + 4);\n" +
 			"	                   ^\n" +
-			"Null pointer access: The variable i can only be null at this location\n" +
+			"Null pointer access: This expression of type Integer is null but requires auto-unboxing\n" +
 			"----------\n",
 		    JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
 	}
@@ -11622,12 +11760,12 @@
 			"1. ERROR in X.java (at line 4)\n" + 
 			"	if(f1 == 1)\n" + 
 			"	   ^^\n" + 
-			"Null pointer access: The variable f1 can only be null at this location\n" + 
+			"Null pointer access: This expression of type Integer is null but requires auto-unboxing\n" +
 			"----------\n" + 
 			"2. ERROR in X.java (at line 7)\n" + 
 			"	int abc = (f2 != 1)? 1 : 0;\n" + 
 			"	           ^^\n" + 
-			"Null pointer access: The variable f2 can only be null at this location\n" + 
+			"Null pointer access: This expression of type Integer is null but requires auto-unboxing\n" +
 			"----------\n" + 
 			"3. ERROR in X.java (at line 9)\n" + 
 			"	if(f3 == null)\n" + 
@@ -11668,12 +11806,12 @@
 			"1. ERROR in X.java (at line 4)\n" +
 			"	if(i1 == 1)\n" +
 			"	   ^^\n" +
-			"Null pointer access: The variable i1 can only be null at this location\n" +
+			"Null pointer access: This expression of type Integer is null but requires auto-unboxing\n" +
 			"----------\n" +
 			"2. ERROR in X.java (at line 7)\n" +
 			"	if(i1 == 0) {}\n" +
 			"	   ^^\n" +
-			"Potential null pointer access: The variable i1 may be null at this location\n" +
+			"Potential null pointer access: This expression of type Integer may be null but requires auto-unboxing\n" +
 			"----------\n");
 	}
 }
@@ -11711,12 +11849,12 @@
 			"1. ERROR in X.java (at line 7)\n" + 
 			"	if(f1 == 1)\n" + 
 			"	   ^^\n" + 
-			"Null pointer access: The variable f1 can only be null at this location\n" + 
+			"Null pointer access: This expression of type Integer is null but requires auto-unboxing\n" +
 			"----------\n" + 
 			"2. ERROR in X.java (at line 10)\n" + 
 			"	int abc = (f2 != 1)? 1 : 0;\n" + 
 			"	           ^^\n" + 
-			"Null pointer access: The variable f2 can only be null at this location\n" + 
+			"Null pointer access: This expression of type Integer is null but requires auto-unboxing\n" +
 			"----------\n" + 
 			"3. ERROR in X.java (at line 12)\n" + 
 			"	if(f3 == null)\n" + 
@@ -11736,12 +11874,12 @@
 			"6. ERROR in X.java (at line 17)\n" + 
 			"	if(a == 1) {}\n" + 
 			"	   ^\n" + 
-			"Null pointer access: The variable a can only be null at this location\n" + 
+			"Null pointer access: This expression of type Integer is null but requires auto-unboxing\n" + 
 			"----------\n" + 
 			"7. ERROR in X.java (at line 18)\n" + 
 			"	if(outer2 == 1) {}\n" + 
 			"	   ^^^^^^\n" + 
-			"Potential null pointer access: The variable outer2 may be null at this location\n" + 
+			"Potential null pointer access: This expression of type Integer may be null but requires auto-unboxing\n" + 
 			"----------\n");
 	}
 }
@@ -11779,12 +11917,12 @@
 			"1. ERROR in X.java (at line 8)\n" + 
 			"	if(f1 == 1)\n" + 
 			"	   ^^\n" + 
-			"Null pointer access: The variable f1 can only be null at this location\n" + 
+			"Null pointer access: This expression of type Integer is null but requires auto-unboxing\n" +
 			"----------\n" + 
 			"2. ERROR in X.java (at line 11)\n" + 
 			"	int abc = (f2 != 1)? 1 : 0;\n" + 
 			"	           ^^\n" + 
-			"Null pointer access: The variable f2 can only be null at this location\n" + 
+			"Null pointer access: This expression of type Integer is null but requires auto-unboxing\n" +
 			"----------\n" + 
 			"3. ERROR in X.java (at line 13)\n" + 
 			"	if(f3 == null)\n" + 
@@ -11804,12 +11942,12 @@
 			"6. ERROR in X.java (at line 18)\n" + 
 			"	if(outer == 1) {}\n" + 
 			"	   ^^^^^\n" + 
-			"Null pointer access: The variable outer can only be null at this location\n" + 
+			"Null pointer access: This expression of type Integer is null but requires auto-unboxing\n" +
 			"----------\n" + 
 			"7. ERROR in X.java (at line 19)\n" + 
 			"	if(param == 1) {}\n" + 
 			"	   ^^^^^\n" + 
-			"Potential null pointer access: The variable param may be null at this location\n" + 
+			"Potential null pointer access: This expression of type Integer may be null but requires auto-unboxing\n" +
 			"----------\n");
 	}
 }
@@ -12162,7 +12300,7 @@
 			"1. ERROR in X.java (at line 4)\n" + 
 			"	int j = i;\n" + 
 			"	        ^\n" + 
-			"Null pointer access: The variable i can only be null at this location\n" + 
+			"Null pointer access: This expression of type Integer is null but requires auto-unboxing\n" + 
 			"----------\n",
 		    JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
 }
@@ -12186,7 +12324,7 @@
 			"1. ERROR in X.java (at line 5)\n" + 
 			"	j = i;\n" + 
 			"	    ^\n" + 
-			"Potential null pointer access: The variable i may be null at this location\n" + 
+			"Potential null pointer access: This expression of type Integer may be null but requires auto-unboxing\n" + 
 			"----------\n",
 		    JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
 }
@@ -12210,7 +12348,7 @@
 			"1. ERROR in X.java (at line 4)\n" + 
 			"	bar(bo);\n" + 
 			"	    ^^\n" + 
-			"Null pointer access: The variable bo can only be null at this location\n" + 
+			"Null pointer access: This expression of type Boolean is null but requires auto-unboxing\n" + 
 			"----------\n",
 		    JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
 }
@@ -12283,72 +12421,77 @@
 			"1. ERROR in X.java (at line 4)\n" + 
 			"	super(b2 == null, b2);\n" + 
 			"	                  ^^\n" + 
-			"Potential null pointer access: The variable b2 may be null at this location\n" + 
+			"Potential null pointer access: This expression of type Boolean may be null but requires auto-unboxing\n" + 
 			"----------\n" + 
-			"2. ERROR in X.java (at line 12)\n" + 
+			"2. ERROR in X.java (at line 9)\n" + 
+			"	boolean fB = (Boolean)null;\n" + 
+			"	             ^^^^^^^^^^^^^\n" + 
+			"Null pointer access: This expression of type Boolean is null but requires auto-unboxing\n" + 
+			"----------\n" + 
+			"3. ERROR in X.java (at line 12)\n" + 
 			"	X x = new X(b1, null);\n" + 
 			"	            ^^\n" + 
-			"Null pointer access: The variable b1 can only be null at this location\n" + 
+			"Null pointer access: This expression of type Boolean is null but requires auto-unboxing\n" + 
 			"----------\n" + 
-			"3. ERROR in X.java (at line 14)\n" + 
+			"4. ERROR in X.java (at line 14)\n" + 
 			"	boolean dontcare = b2 && inB;\n" + 
 			"	                   ^^\n" + 
-			"Null pointer access: The variable b2 can only be null at this location\n" + 
+			"Null pointer access: This expression of type Boolean is null but requires auto-unboxing\n" + 
 			"----------\n" + 
-			"4. ERROR in X.java (at line 16)\n" + 
+			"5. ERROR in X.java (at line 16)\n" + 
 			"	dontcare = inB || b3;\n" + 
 			"	                  ^^\n" + 
-			"Null pointer access: The variable b3 can only be null at this location\n" + 
+			"Null pointer access: This expression of type Boolean is null but requires auto-unboxing\n" + 
 			"----------\n" + 
-			"5. ERROR in X.java (at line 18)\n" + 
+			"6. ERROR in X.java (at line 18)\n" + 
 			"	char[] cs = new char[dims];\n" + 
 			"	                     ^^^^\n" + 
-			"Null pointer access: The variable dims can only be null at this location\n" + 
+			"Null pointer access: This expression of type Integer is null but requires auto-unboxing\n" + 
 			"----------\n" + 
-			"6. ERROR in X.java (at line 22)\n" + 
+			"7. ERROR in X.java (at line 22)\n" + 
 			"	for (int i=0;b4; i++);\n" + 
 			"	             ^^\n" + 
-			"Null pointer access: The variable b4 can only be null at this location\n" + 
+			"Null pointer access: This expression of type Boolean is null but requires auto-unboxing\n" + 
 			"----------\n" + 
-			"7. ERROR in X.java (at line 23)\n" + 
+			"8. ERROR in X.java (at line 23)\n" + 
 			"	} while (b5);\n" + 
 			"	         ^^\n" + 
-			"Null pointer access: The variable b5 can only be null at this location\n" + 
+			"Null pointer access: This expression of type Boolean is null but requires auto-unboxing\n" + 
 			"----------\n" + 
-			"8. ERROR in X.java (at line 25)\n" + 
+			"9. ERROR in X.java (at line 25)\n" + 
 			"	if (b6) { }\n" + 
 			"	    ^^\n" + 
-			"Null pointer access: The variable b6 can only be null at this location\n" + 
+			"Null pointer access: This expression of type Boolean is null but requires auto-unboxing\n" + 
 			"----------\n" + 
-			"9. ERROR in X.java (at line 27)\n" + 
+			"10. ERROR in X.java (at line 27)\n" + 
 			"	Z z = this.new Z(b7);\n" + 
 			"	                 ^^\n" + 
-			"Null pointer access: The variable b7 can only be null at this location\n" + 
+			"Null pointer access: This expression of type Boolean is null but requires auto-unboxing\n" + 
 			"----------\n" + 
-			"10. ERROR in X.java (at line 29)\n" + 
+			"11. ERROR in X.java (at line 29)\n" + 
 			"	switch(sel) {\n" + 
 			"	       ^^^\n" + 
-			"Null pointer access: The variable sel can only be null at this location\n" + 
+			"Null pointer access: This expression of type Integer is null but requires auto-unboxing\n" + 
 			"----------\n" + 
-			"11. ERROR in X.java (at line 34)\n" + 
+			"12. ERROR in X.java (at line 34)\n" + 
 			"	while (b8) {}\n" + 
 			"	       ^^\n" + 
-			"Null pointer access: The variable b8 can only be null at this location\n" + 
+			"Null pointer access: This expression of type Boolean is null but requires auto-unboxing\n" + 
 			"----------\n" + 
-			"12. ERROR in X.java (at line 36)\n" + 
+			"13. ERROR in X.java (at line 36)\n" + 
 			"	dontcare = (boolean)b9;\n" + 
 			"	                    ^^\n" + 
-			"Null pointer access: The variable b9 can only be null at this location\n" + 
+			"Null pointer access: This expression of type Boolean is null but requires auto-unboxing\n" + 
 			"----------\n" + 
-			"13. ERROR in X.java (at line 38)\n" + 
+			"14. ERROR in X.java (at line 38)\n" + 
 			"	assert b10 : \"shouldn\'t happen, but will\";\n" + 
 			"	       ^^^\n" + 
-			"Null pointer access: The variable b10 can only be null at this location\n" + 
+			"Null pointer access: This expression of type Boolean is null but requires auto-unboxing\n" + 
 			"----------\n" + 
-			"14. ERROR in X.java (at line 40)\n" + 
+			"15. ERROR in X.java (at line 40)\n" + 
 			"	return b11;\n" + 
 			"	       ^^^\n" + 
-			"Null pointer access: The variable b11 can only be null at this location\n" + 
+			"Null pointer access: This expression of type Boolean is null but requires auto-unboxing\n" + 
 			"----------\n",
 		    JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
 }
@@ -12411,17 +12554,17 @@
 			"1. ERROR in X.java (at line 12)\n" + 
 			"	} while (b2);\n" + 
 			"	         ^^\n" + 
-			"Potential null pointer access: The variable b2 may be null at this location\n" + 
+			"Potential null pointer access: This expression of type Boolean may be null but requires auto-unboxing\n" + 
 			"----------\n" + 
 			"2. ERROR in X.java (at line 15)\n" + 
 			"	} while (b3);\n" + 
 			"	         ^^\n" + 
-			"Null pointer access: The variable b3 can only be null at this location\n" + 
+			"Null pointer access: This expression of type Boolean is null but requires auto-unboxing\n" + 
 			"----------\n" + 
 			"3. ERROR in X.java (at line 42)\n" + 
 			"	} while (b7);\n" + 
 			"	         ^^\n" + 
-			"Potential null pointer access: The variable b7 may be null at this location\n" + 
+			"Potential null pointer access: This expression of type Boolean may be null but requires auto-unboxing\n" + 
 			"----------\n",
 			null/*classLibraries*/,
 			true/*shouldFlushOutputDirectory*/,
@@ -16210,4 +16353,169 @@
 		"Potential null pointer access: The variable s may be null at this location\n" + 
 		"----------\n");
 }
+// Bug 401088 - [compiler][null] Wrong warning "Redundant null check" inside nested try statement
+public void testBug401088() {
+	runConformTest(
+		new String[] {
+			"X.java",
+			"public class X {\n" + 
+			"\n" + 
+			"	private static void occasionallyThrowException() throws Exception {\n" + 
+			"		throw new Exception();\n" + 
+			"	}\n" + 
+			"\n" + 
+			"	private static void open() throws Exception {\n" + 
+			"		occasionallyThrowException();\n" + 
+			"	}\n" + 
+			"\n" + 
+			"	private static void close() throws Exception {\n" + 
+			"		occasionallyThrowException();\n" + 
+			"	}\n" + 
+			"\n" + 
+			"	public static void main(String s[]) {\n" + 
+			"		Exception exc = null;\n" + 
+			"		try {\n" + 
+			"			open();\n" + 
+			"			// do more things\n" + 
+			"		}\n" + 
+			"		catch (Exception e) {\n" + 
+			"			exc = e;\n" + 
+			"		}\n" + 
+			"		finally {\n" + 
+			"			try {\n" + 
+			"				close();\n" + 
+			"			}\n" + 
+			"			catch (Exception e) {\n" + 
+			"				if (exc == null) // should not warn on this line\n" + 
+			"					exc = e;\n" + 
+			"			}\n" + 
+			"		}\n" + 
+			"		if (exc != null)\n" + 
+			"			System.out.println(exc);\n" + 
+			"	}\n" + 
+			"}\n"
+		},
+		"java.lang.Exception");
+}
+// Bug 401088 - [compiler][null] Wrong warning "Redundant null check" inside nested try statement
+public void testBug401088a() {
+ runConformTest(
+     new String[] {
+         "X.java",
+         "public class X {\n" + 
+         "\n" + 
+         "   private static void occasionallyThrowException() throws Exception {\n" + 
+         "       throw new Exception();\n" + 
+         "   }\n" + 
+         "\n" + 
+         "   private static void open() throws Exception {\n" + 
+         "       occasionallyThrowException();\n" + 
+         "   }\n" + 
+         "\n" + 
+         "   private static void close() throws Exception {\n" + 
+         "       occasionallyThrowException();\n" + 
+         "   }\n" + 
+         "\n" + 
+         "   public static void main(String s[]) {\n" + 
+         "       Exception exc = null;\n" + 
+         "       try {\n" + 
+         "           open();\n" + 
+         "           // do more things\n" + 
+         "       }\n" + 
+         "       catch (Exception e) {\n" + 
+         "           exc = e;\n" + 
+         "       }\n" + 
+         "       finally {\n" + 
+         "           try {\n" + 
+         "               close();\n" + 
+         "           }\n" + 
+         "           catch (Exception e) {\n" + 
+         "               if (exc == null) // should not warn on this line\n" + 
+         "                   exc = e;\n" + 
+         "           }\n" + 
+         "           finally { System.out.print(1); }\n" + 
+         "       }\n" + 
+         "       if (exc != null)\n" + 
+         "           System.out.println(exc);\n" + 
+         "   }\n" + 
+         "}\n"
+     },
+     "1java.lang.Exception");
+}
+// Bug 401092 - [compiler][null] Wrong warning "Redundant null check" in outer catch of nested try
+public void test401092() {
+	runConformTest(
+		new String[] {
+			"X.java",
+			"import java.util.Date;\n" + 
+			"\n" + 
+			"public class X {\n" + 
+			"\n" + 
+			"    private static void occasionallyThrowException() throws Exception {\n" + 
+			"        throw new Exception();\n" + 
+			"    }\n" + 
+			"\n" + 
+			"    private static Date createDate() throws Exception {\n" + 
+			"        occasionallyThrowException();\n" + 
+			"        return new Date();\n" + 
+			"    }\n" + 
+			"\n" + 
+			"    public static void main(String s[]) {\n" + 
+			"        Date d = null;\n" + 
+			"        try {\n" + 
+			"            d = createDate();\n" + 
+			"            System.out.println(d.toString());\n" + 
+			"            try {\n" + 
+			"                occasionallyThrowException();\n" + 
+			"            }\n" + 
+			"            catch (Exception exc) {\n" + 
+			"            }\n" + 
+			"        }\n" + 
+			"        catch (Exception exc) {\n" + 
+			"            if (d != null) // should not warn in this line\n" + 
+			"                System.out.println(d.toString());\n" + 
+			"        }\n" + 
+			"    }\n" + 
+			"}\n"
+		});
+}
+// Bug 401092 - [compiler][null] Wrong warning "Redundant null check" in outer catch of nested try
+public void test401092a() {
+	runConformTest(
+		new String[] {
+			"X.java",
+			"import java.util.Date;\n" + 
+			"\n" + 
+			"public class X {\n" + 
+			"\n" + 
+			"    private static void occasionallyThrowException() throws Exception {\n" + 
+			"        throw new Exception();\n" + 
+			"    }\n" + 
+			"\n" + 
+			"    private static Date createDate() throws Exception {\n" + 
+			"        occasionallyThrowException();\n" + 
+			"        return new Date();\n" + 
+			"    }\n" + 
+			"\n" + 
+			"    public static void main(String s[]) {\n" + 
+			"        Date d = null;\n" + 
+			"        try {\n" + 
+			"            d = createDate();\n" + 
+			"            System.out.println(d.toString());\n" + 
+			"            try {\n" + 
+			"                occasionallyThrowException();\n" + 
+			"            }\n" + 
+			"            catch (Exception exc) {\n" + 
+			"            }\n" +
+			"            finally { System.out.println(1); }\n" + 
+			"        }\n" + 
+			"        catch (Exception exc) {\n" + 
+			"            if (d != null) // should not warn in this line\n" + 
+			"                System.out.println(d.toString());\n" + 
+			"        }\n" +
+			"        finally { System.out.println(2); }\n" + 
+			"    }\n" + 
+			"}\n"
+		});
+}
 }
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTestAsserts.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTestAsserts.java
index 98df523..82cb7cf 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTestAsserts.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTestAsserts.java
@@ -1,12 +1,14 @@
 /*******************************************************************************
- * Copyright (c) 2012 IBM Corporation and others.
+ * Copyright (c) 2013 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
  * http://www.eclipse.org/legal/epl-v10.html
  *
  * Contributors:
- *     IBM Corporation - initial API and implementation
+ *		IBM Corporation - initial API and implementation
+ *		Stephan Herrmann - Contribution for
+ *								bug 382069 - [null] Make the null analysis consider JUnit's assertNotNull similarly to assertions
  *******************************************************************************/
 package org.eclipse.jdt.core.tests.compiler.regression;
 
@@ -35,11 +37,74 @@
 // Only the highest compliance level is run; add the VM argument
 // -Dcompliance=1.4 (for example) to lower it if needed
 static {
-//		TESTS_NAMES = new String[] { "testBug373953" };
+//		TESTS_NAMES = new String[] { "testBug382069" };
 //		TESTS_NUMBERS = new int[] { 561 };
 //		TESTS_RANGE = new int[] { 1, 2049 };
 }
 
+static final String JUNIT_ASSERT_NAME = "junit/framework/Assert.java";
+static final String JUNIT_ASSERT_CONTENT = "package junit.framework;\n" +
+		"public class Assert {\n" +
+		"    static public void assertNull(Object object) {}\n" +
+		"    static public void assertNull(String message, Object object) {}\n" +
+		"    static public void assertNotNull(Object object) {}\n" +
+		"    static public void assertNotNull(String message, Object object) {}\n" +
+		"    static public void assertTrue(boolean expression) {}\n" +
+		"    static public void assertTrue(String message, boolean expression) {}\n" +
+		"    static public void assertFalse(boolean expression) {}\n" +
+		"    static public void assertFalse(String message, boolean expression) {}\n" +
+		"}\n";
+
+static final String ORG_JUNIT_ASSERT_NAME = "org/junit/Assert.java";
+static final String ORG_JUNIT_ASSERT_CONTENT = "package org.junit;\n" +
+		"public class Assert {\n" +
+		"    static public void assertNull(Object object) {}\n" +
+		"    static public void assertNull(String message, Object object) {}\n" +
+		"    static public void assertNotNull(Object object) {}\n" +
+		"    static public void assertNotNull(String message, Object object) {}\n" +
+		"    static public void assertTrue(boolean expression) {}\n" +
+		"    static public void assertTrue(String message, boolean expression) {}\n" +
+		"    static public void assertFalse(boolean expression) {}\n" +
+		"    static public void assertFalse(String message, boolean expression) {}\n" +
+		"}\n";
+
+static final String APACHE_VALIDATE_NAME = "org/apache/commons/lang/Validate.java";
+static final String APACHE_VALIDATE_CONTENT = "package org.apache.commons.lang;\n" +
+		"public class Validate {\n" +
+		"    static public void notNull(Object object) {}\n" +
+		"    static public void notNull(Object object, String message) {}\n" +
+		"    static public void isTrue(boolean expression) {}\n" +
+		"    static public void isTrue(boolean expression, String message) {}\n" +
+		"    static public void isTrue(boolean expression, String message, double value) {}\n" +
+		"    static public void isTrue(boolean expression, String message, long value) {}\n" +
+		"    static public void isTrue(boolean expression, String message, Object value) {}\n" +
+		"}\n";
+
+static final String APACHE_3_VALIDATE_NAME = "org/apache/commons/lang3/Validate.java";
+static final String APACHE_3_VALIDATE_CONTENT = "package org.apache.commons.lang3;\n" +
+		"public class Validate {\n" +
+		"    static public <T> T notNull(T object) { return object; }\n" +
+		"    static public <T> T notNull(T object, String message, Object... values) { return object; }\n" +
+		"    static public void isTrue(boolean expression) {}\n" +
+		"    static public void isTrue(boolean expression, String message, double value) {}\n" +
+		"    static public void isTrue(boolean expression, String message, long value) {}\n" +
+		"    static public void isTrue(boolean expression, String message, Object value) {}\n" +
+		"}\n";
+
+static final String GOOGLE_PRECONDITIONS_NAME = "com/google/common/base/Preconditions.java";
+static final String GOOGLE_PRECONDITIONS_CONTENT = "package com.google.common.base;\n" +
+		"public class Preconditions {\n" +
+		"    static public <T> T checkNotNull(T object) { return object; }\n" +
+		"    static public <T> T checkNotNull(T object, Object message) { return object; }\n" +
+		"    static public <T> T checkNotNull(T object, String message, Object... values) { return object; }\n" +
+		"    static public void checkArgument(boolean expression) {}\n" +
+		"    static public void checkArgument(boolean expression, Object message) {}\n" +
+		"    static public void checkArgument(boolean expression, String msgTmpl, Object... messageArgs) {}\n" +
+		"    static public void checkState(boolean expression) {}\n" +
+		"    static public void checkState(boolean expression, Object message) {}\n" +
+		"    static public void checkState(boolean expression, String msgTmpl, Object... messageArgs) {}\n" +
+		"}\n";
+
 public static Test suite() {
 	return buildAllCompliancesTestSuite(testClass());
 }
@@ -91,7 +156,7 @@
 				"}\n"},
 			"",
 			this.assertLib,
-			false,
+			true,
 			null);
 }
 
@@ -751,4 +816,249 @@
 			"Potential null pointer access: The variable o may be null at this location\n" + 
 			"----------\n");
 }
+
+// https://bugs.eclipse.org/382069 - [null] Make the null analysis consider JUnit's assertNotNull similarly to assertions
+// junit's assertNotNull
+public void testBug382069a() throws IOException {
+	this.runConformTest(
+		new String[] {
+			JUNIT_ASSERT_NAME,
+			JUNIT_ASSERT_CONTENT,
+			"X.java",
+			"public class X {\n" +
+			"  void foo(Object o1, String o2) {\n" +
+			"    boolean b = o1 != null;\n" + // sheds doubts upon o1
+			"    junit.framework.Assert.assertNotNull(o1);\n" + 	// protection
+			"    o1.toString();\n" + 		// quiet
+			"    b = o2 != null;\n" + // sheds doubts upon o2
+			"    junit.framework.Assert.assertNotNull(\"msg\", o2);\n" + 	// protection
+			"    o2.toString();\n" + 		// quiet
+			"  }\n" +
+			"}\n"},
+		"");
+}
+
+// https://bugs.eclipse.org/382069 - [null] Make the null analysis consider JUnit's assertNotNull similarly to assertions
+// org.eclipse.core.runtime.Assert.isNotNull
+public void testBug382069b() {
+	if (this.complianceLevel >= ClassFileConstants.JDK1_5) {
+		this.runConformTest(
+			new String[] {
+		"X.java",
+				"public class X {\n" + 
+				"  void foo(Object o1, String o2) {\n" +
+				"    boolean b = o1 != null;\n" + // sheds doubts upon o1
+				"    org.eclipse.core.runtime.Assert.isNotNull(o1);\n" + 	// protection
+				"    o1.toString();\n" + 		// quiet
+				"    b = o2 != null;\n" + // sheds doubts upon o2
+				"    org.eclipse.core.runtime.Assert.isNotNull(o2, \"msg\");\n" + 	// protection
+				"    o2.toString();\n" + 		// quiet
+				"  }\n" +
+				"}"	
+			},
+			"",
+			this.assertLib,
+			true,
+			null);
+	}
+}
+
+// https://bugs.eclipse.org/382069 - [null] Make the null analysis consider JUnit's assertNotNull similarly to assertions
+// junit's assertNull and dead code analysis
+public void testBug382069c() throws IOException {
+	this.runNegativeTest(
+		new String[] {
+			JUNIT_ASSERT_NAME,
+			JUNIT_ASSERT_CONTENT,
+			"X.java",
+			"public class X {\n" +
+			"  boolean foo(String o1, String o2) {\n" +
+			"    junit.framework.Assert.assertNull(\"something's wrong\", o1);\n" + 	// establish nullness
+			"    if (o2 == null)\n" +
+			"        return o1 != null;\n" +
+			"    junit.framework.Assert.assertNull(o2);\n" + // will always throw
+			"    return false; // dead code\n" +
+			"  }\n" +
+			"  void bar(X x) {\n" +
+			"    if (x == null) {\n" +
+			"      junit.framework.Assert.assertNotNull(x);\n" +
+			"      return; // dead code\n" +
+			"    }\n" +
+			"  }\n" +
+			"}\n"},
+			"----------\n" + 
+			"1. ERROR in X.java (at line 5)\n" + 
+			"	return o1 != null;\n" + 
+			"	       ^^\n" + 
+			"Null comparison always yields false: The variable o1 can only be null at this location\n" + 
+			"----------\n" + 
+			"2. WARNING in X.java (at line 7)\n" + 
+			"	return false; // dead code\n" + 
+			"	^^^^^^^^^^^^^\n" + 
+			"Dead code\n" + 
+			"----------\n" + 
+			"3. WARNING in X.java (at line 12)\n" + 
+			"	return; // dead code\n" + 
+			"	^^^^^^^\n" + 
+			"Dead code\n" + 
+			"----------\n");
+}
+// https://bugs.eclipse.org/382069 - [null] Make the null analysis consider JUnit's assertNotNull similarly to assertions
+// various asserts from org.apache.commons.lang.Validate
+public void testBug382069d() throws IOException {
+	this.runNegativeTest(
+		new String[] {
+			APACHE_VALIDATE_NAME,
+			APACHE_VALIDATE_CONTENT,
+			"X.java",
+			"import org.apache.commons.lang.Validate;\n" +
+			"public class X {\n" +
+			"  void foo(Object o1, String o2, X x) {\n" +
+			"    boolean b = o1 != null;\n" + // sheds doubts upon o1
+			"    Validate.notNull(o1);\n" + 	// protection
+			"    o1.toString();\n" + 		// quiet
+			"    b = o2 != null;\n" + // sheds doubts upon o2
+			"    Validate.notNull(o2, \"msg\");\n" + 	// protection
+			"    o2.toString();\n" + 		// quiet
+			"    Validate.isTrue(x == null, \"ups\", x);\n" +
+			"    x.foo(null, null, null); // definite NPE\n" +
+			"  }\n" +
+			"}\n"},
+			"----------\n" + 
+			"1. ERROR in X.java (at line 11)\n" + 
+			"	x.foo(null, null, null); // definite NPE\n" + 
+			"	^\n" + 
+			"Null pointer access: The variable x can only be null at this location\n" + 
+			"----------\n");
+}
+// https://bugs.eclipse.org/382069 - [null] Make the null analysis consider JUnit's assertNotNull similarly to assertions
+// various asserts from org.apache.commons.lang3Validate
+public void testBug382069e() throws IOException {
+	if (this.complianceLevel >= ClassFileConstants.JDK1_5) {
+		this.runNegativeTest(
+			new String[] {
+				APACHE_3_VALIDATE_NAME,
+				APACHE_3_VALIDATE_CONTENT,
+				"X.java",
+				"import org.apache.commons.lang3.Validate;\n" +
+				"public class X {\n" +
+				"  void foo(Object o1, String o2, X x) {\n" +
+				"    boolean b = o1 != null;\n" + // sheds doubts upon o1
+				"    Validate.notNull(o1);\n" + 	// protection
+				"    o1.toString();\n" + 		// quiet
+				"    b = o2 != null;\n" + // sheds doubts upon o2
+				"    Validate.notNull(o2, \"msg\");\n" + 	// protection
+				"    o2.toString();\n" + 		// quiet
+				"    Validate.isTrue(x == null, \"ups\", x);\n" +
+				"    x.foo(null, null, null); // definite NPE\n" +
+				"  }\n" +
+				"}\n"},
+				"----------\n" + 
+				"1. ERROR in X.java (at line 11)\n" + 
+				"	x.foo(null, null, null); // definite NPE\n" + 
+				"	^\n" + 
+				"Null pointer access: The variable x can only be null at this location\n" + 
+				"----------\n");
+	}
+}
+// https://bugs.eclipse.org/382069 - [null] Make the null analysis consider JUnit's assertNotNull similarly to assertions
+// various asserts from com.google.common.base.Preconditions
+public void testBug382069f() throws IOException {
+	if (this.complianceLevel >= ClassFileConstants.JDK1_5) {
+		this.runNegativeTest(
+			new String[] {
+				GOOGLE_PRECONDITIONS_NAME,
+				GOOGLE_PRECONDITIONS_CONTENT,
+				"X.java",
+				"import com.google.common.base.Preconditions;\n" +
+				"public class X {\n" +
+				"  void foo(Object o1, String o2, X x) {\n" +
+				"    boolean b = o1 != null;\n" + // sheds doubts upon o1
+				"    Preconditions.checkNotNull(o1);\n" + 	// protection
+				"    o1.toString();\n" + 		// quiet
+				"    b = o2 != null;\n" + // sheds doubts upon o2
+				"    Preconditions.checkNotNull(o2, \"msg {0}.{1}\", o1, o2);\n" + 	// protection
+				"    o2.toString();\n" + 		// quiet
+				"    Preconditions.checkArgument(x == null, \"ups\");\n" +
+				"    x.foo(null, null, null); // definite NPE\n" +
+				"  }\n" +
+				"}\n"},
+				"----------\n" + 
+				"1. ERROR in X.java (at line 11)\n" + 
+				"	x.foo(null, null, null); // definite NPE\n" + 
+				"	^\n" + 
+				"Null pointer access: The variable x can only be null at this location\n" + 
+				"----------\n");
+	}
+}
+// https://bugs.eclipse.org/382069 - [null] Make the null analysis consider JUnit's assertNotNull similarly to assertions
+// java.util.Objects#requireNonNull
+public void testBug382069g() throws IOException {
+	if (this.complianceLevel >= ClassFileConstants.JDK1_7) {
+		this.runConformTest(
+			new String[] {
+				"X.java",
+				"import static java.util.Objects.requireNonNull;\n" +
+				"public class X {\n" +
+				"  void foo(Object o1, String o2, X x) {\n" +
+				"    boolean b = o1 != null;\n" + // sheds doubts upon o1
+				"    requireNonNull(o1);\n" + 	// protection
+				"    o1.toString();\n" + 		// quiet
+				"    b = o2 != null;\n" + // sheds doubts upon o2
+				"    requireNonNull(o2, \"msg\");\n" + 	// protection
+				"    o2.toString();\n" + 		// quiet
+				"  }\n" +
+				"}\n"},
+				"");
+	}
+}
+
+// https://bugs.eclipse.org/382069 - [null] Make the null analysis consider JUnit's assertNotNull similarly to assertions
+// junit's assertTrue / assertFalse
+public void testBug382069h() throws IOException {
+	this.runConformTest(
+		new String[] {
+			JUNIT_ASSERT_NAME,
+			JUNIT_ASSERT_CONTENT,
+			"X.java",
+			"public class X {\n" +
+			"  void foo(Object o1, String o2) {\n" +
+			"    boolean b = o1 != null;\n" + // sheds doubts upon o1
+			"    junit.framework.Assert.assertTrue(o1 != null);\n" + 	// protection
+			"    o1.toString();\n" + 		// quiet
+			"    b = o2 != null;\n" + // sheds doubts upon o2
+			"    junit.framework.Assert.assertFalse(\"msg\", o2 == null);\n" + 	// protection
+			"    o2.toString();\n" + 		// quiet
+			"  }\n" +
+			"}\n"},
+		"");
+}
+// Bug 401159 - [null] Respect org.junit.Assert for control flow
+// various asserts from org.junit.Assert
+public void testBug401159() throws IOException {
+	this.runNegativeTest(
+		new String[] {
+			ORG_JUNIT_ASSERT_NAME,
+			ORG_JUNIT_ASSERT_CONTENT,
+			"X.java",
+			"import org.junit.Assert;\n" +
+			"public class X {\n" +
+			"  void foo(Object o1, String o2, X x) {\n" +
+			"    boolean b = o1 != null;\n" + // sheds doubts upon o1
+			"    Assert.assertNotNull(o1);\n" + 	// protection
+			"    o1.toString();\n" + 		// quiet
+			"    b = o2 != null;\n" + // sheds doubts upon o2
+			"    Assert.assertNotNull(\"msg\", o2);\n" + 	// protection
+			"    o2.toString();\n" + 		// quiet
+			"    Assert.assertTrue(\"ups\", x == null);\n" +
+			"    x.foo(null, null, null); // definite NPE\n" +
+			"  }\n" +
+			"}\n"},
+			"----------\n" + 
+			"1. ERROR in X.java (at line 11)\n" + 
+			"	x.foo(null, null, null); // definite NPE\n" + 
+			"	^\n" + 
+			"Null pointer access: The variable x can only be null at this location\n" + 
+			"----------\n");
+}
 }
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java
index 9162aa6..5ef1b36 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -11,6 +11,8 @@
  *								bug 328281 - visibility leaks not detected when analyzing unused field in private class
  *								bug 379784 - [compiler] "Method can be static" is not getting reported
  *								bug 379834 - Wrong "method can be static" in presence of qualified super and different staticness of nested super class.
+ *     Jesper S Moller <jesper@selskabet.org> - Contributions for
+ *								bug 378674 - "The method can be declared as static" is wrong
  *******************************************************************************/
 package org.eclipse.jdt.core.tests.compiler.regression;
 
@@ -8145,4 +8147,231 @@
 		compilerOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, oldOption);
 	}
 }
+private void runStaticWarningConformTest(String fileName, String body) {
+	if (this.complianceLevel < ClassFileConstants.JDK1_5)
+		return;
+	Map compilerOptions = getCompilerOptions();
+	compilerOptions.put(CompilerOptions.OPTION_ReportMethodCanBeStatic, CompilerOptions.ERROR);
+	compilerOptions.put(CompilerOptions.OPTION_ReportMethodCanBePotentiallyStatic, CompilerOptions.ERROR);
+	this.runConformTest(
+		new String[] {
+			fileName, 
+			body
+		},
+		compilerOptions /* custom options */
+	);
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=378674
+//Can be static warning shown in the wrong places, i.e. if the type parameter is used in the signature
+public void test378674_comment0() {
+	runStaticWarningConformTest(
+		"Test.java", 
+		"public class Test<T> {\n" + 
+		"\n" + 
+		"    @SuppressWarnings({ \"unchecked\", \"rawtypes\" })\n" + 
+		"    public static void main(String[] args) {\n" + 
+		"        new Test().method(null);\n" + 
+		"    }\n" + 
+		"\n" + 
+		"    private static class SubClass<A> {\n" + 
+		"\n" + 
+		"    }\n" + 
+		"\n" + 
+		"    private void method(SubClass<T> s) {\n" + 
+		"        System.out.println(s);\n" + 
+		"    }\n" + 
+		"\n" + 
+		"}\n" + 
+		""
+	);
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=378674
+public void test378674_comment1b() {
+	runStaticWarningConformTest(
+		"X.java", 
+		"import java.util.Collection;\n" +
+		"class X<E>{\n" + 
+		"   public final <E1> Collection<E> go() {  // cannot be static\n" + 
+		"		return null; \n" + 
+		"   }\n" + 
+		"}\n" + 
+		""
+	);
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=378674
+//Can be static warning shown in the wrong places
+public void test378674_comment1c() {
+	runStaticWarningConformTest(
+		"X.java", 
+		"import java.util.Collection;\n" +
+		"import java.util.ArrayList;\n" +
+		"	class X<E>{\n" + 
+		"   public final <E1> Collection<?> go() {  // cannot be static\n" + 
+		"		return new ArrayList<E>(); \n" + 
+		"   }\n" + 
+		"}\n" + 
+		""
+	);
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=378674
+//Can be static warning shown in the wrong places
+public void test378674_comment2() {
+	runStaticWarningConformTest(
+		"X.java", 
+		"public class X<T> {\n" + 
+		"	public final void foo() {\n" + 
+		"		java.util.List<T> k;\n" + 
+		"	}\n" + 
+		"}\n" + 
+		""
+	);
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=378674
+public void test378674_comment3() {
+	runStaticWarningConformTest(
+		"Test.java", 
+		"public class Test {\n" + 
+		"	//false positive of method can be declared static\n" + 
+		"	void bar() {\n" + 
+		"		foo(Test.this);\n" + 
+		"	}\n" + 
+		"\n" + 
+		"	private static void foo(Test test) {\n" + 
+		"		System.out.println(test.getClass().getName());\n" + 
+		"	}\n" + 
+		"}\n" + 
+		""
+	);
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=378674
+//Can be static warning shown in the wrong places
+public void test378674_comment5a() {
+	runStaticWarningConformTest(
+		"Test.java", 
+		"public class Test<T> {\n" + 
+		"\n" + 
+		"    @SuppressWarnings({ \"unchecked\", \"rawtypes\" })\n" + 
+		"    public static void main(String[] args) {\n" + 
+		"        new Test().method2(null);\n" + 
+		"    }\n" + 
+		"\n" + 
+		"    private static class SubClass<A> {\n" + 
+		"\n" + 
+		"    }\n" + 
+		"\n" + 
+		"    private void method2(SubClass<java.util.List<T>> s) {\n" + 
+		"        System.out.println(s);\n" + 
+		"    }\n" + 
+		"\n" + 
+		"}\n" + 
+		""
+	);
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=378674
+public void test378674_comment5b() {
+	runStaticWarningConformTest(
+		"Test.java", 
+		"public class Test<T> {\n" + 
+		"\n" + 
+		"    @SuppressWarnings({ \"unchecked\", \"rawtypes\" })\n" + 
+		"    public static void main(String[] args) {\n" + 
+		"        new Test().method();\n" + 
+		"    }\n" + 
+		"\n" + 
+		"    private java.util.Collection<T> method() {\n" + 
+		"        return null;\n" + 
+		"    }\n" + 
+		"\n" + 
+		"}\n" + 
+		""
+	);
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=378674
+public void test378674_comment9() {
+	runStaticWarningConformTest(
+		"Test.java", 
+		"public class Test<T> {\n" + 
+		"\n" + 
+		"    @SuppressWarnings({ \"rawtypes\" })\n" + 
+		"    public static void main(String[] args) {\n" + 
+		"        new Test().method();\n" + 
+		"    }\n" + 
+		"\n" + 
+		"    private java.util.Collection<? extends T> method() {\n" + 
+		"        return null;\n" + 
+		"    }\n" + 
+		"}\n" + 
+		""
+	);
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=378674
+public void test378674_comment11() {
+	runStaticWarningConformTest(
+		"Test.java", 
+		"public class Test<T> {\n" + 
+		"\n" + 
+		"    @SuppressWarnings({ \"rawtypes\" })\n" + 
+		"    public static void main(String[] args) {\n" + 
+		"        new Test().method1();\n" + 
+		"        new Test().method2();\n" + 
+		"    }\n" + 
+		"\n" + 
+		"   private <TT extends T> TT method1() { \n" + 
+		"		return null;\n" + 
+		"	}\n" + 
+		"\n" + 
+		"   private <TT extends Object & Comparable<? super T>> TT method2() { \n" + 
+		"		return null;\n" + 
+		"	}\n" + 
+		"}\n" + 
+		""
+	);
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=378674
+public void test378674_comment21a() {
+	runStaticWarningConformTest(
+		"X.java", 
+		"public class X<P extends Exception> {\n" +
+		"	final <T> void foo(T x) throws P {\n" +
+		"	}\n" +
+		"}\n" + 
+		""
+	);
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=378674
+public void test378674_comment21b() {
+	runStaticWarningConformTest(
+		"X.java", 
+		"public class X<P extends Exception> {\n" +
+		"	final <T> void foo(T x) {\n" +
+		"		Object o = (P) null;\n" +
+		"	}\n" +
+		"}\n"
+	);
+}//https://bugs.eclipse.org/bugs/show_bug.cgi?id=378674
+public void test378674_comment21c() {
+	runStaticWarningConformTest(
+		"X.java", 
+		"public class X<P extends Exception> {\n" +
+		"	final <T> void foo(T x) {\n" +
+		"		new Outer().new Inner<P>();\n" +
+		"	}\n" +
+		"}\n" +
+		"class Outer {\n" +
+		"	class Inner<Q> {}\n" +
+		"}\n"
+	);
+}//https://bugs.eclipse.org/bugs/show_bug.cgi?id=378674
+public void test378674_comment21d() {
+	runStaticWarningConformTest(
+		"X.java", 
+		"public class X<P extends Exception> {\n" +
+		"	final <T> void foo(T x) {\n" +
+		"		class Local {\n" +
+		"			P p;\n" +
+		"		}\n" +
+		"	}\n" +
+		"}\n"
+	);
+}
 }
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java
index a2d81a4..7abac61 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -7,7 +7,9 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
- *     Stephan Herrmann <stephan@cs.tu-berlin.de> - Contribution for bug 185682 - Increment/decrement operators mark local variables as read
+ *     Stephan Herrmann - Contributions for
+ *								bug 185682 - Increment/decrement operators mark local variables as read
+ *								bug 401271 - StackOverflowError when searching for a methods references
  *******************************************************************************/
 package org.eclipse.jdt.core.tests.compiler.regression;
 
@@ -18,7 +20,8 @@
 	// Static initializer to specify tests subset using TESTS_* static variables
 	// All specified tests which do not belong to the class are skipped...
 	static {
-//		TESTS_NAMES = new String[] { "test036" };
+//		TESTS_NAMES = new String[] { "testBug401271" };
+//		TESTS_NAMES = new String[] { "test085c" };
 //		TESTS_NUMBERS = new int[] { 80 };
 //		TESTS_RANGE = new int[] { 75, -1 };
 	}
@@ -3077,5 +3080,34 @@
 			"Bar\'s field B");
 	}
 
+	// https://bugs.eclipse.org/401271 - StackOverflowError when searching for a methods references
+	public void testBug401271() {
+		runNegativeTest(
+			new String[] {
+				"a/b/c/a.java",
+				"package a.b.c;\n" +
+				"public class a {}\n",
+				"a/b/c/C.java",
+				"package a.b.c;\n" +
+				"public class C {\n" + 
+				"	public static final int a = 3;\n" + 
+				"}\n",
+				"x/y/R.java",
+				"package x.y;\n" + 
+				"import static a.b.c.C.a;\n" + 
+				"//import a.b.c.a;\n" + 
+				"\n" + 
+				"public class R { \n" + 
+				"	a b; \n" + 
+				"	char h = a; \n" + 
+				"}"
+			},
+			"----------\n" + 
+			"1. ERROR in x\\y\\R.java (at line 6)\n" + 
+			"	a b; \n" + 
+			"	^\n" + 
+			"a cannot be resolved to a type\n" + 
+			"----------\n");
+	}
 }
 
diff --git a/org.eclipse.jdt.core.tests.model/pom.xml b/org.eclipse.jdt.core.tests.model/pom.xml
index 1415479..ee39c3f 100644
--- a/org.eclipse.jdt.core.tests.model/pom.xml
+++ b/org.eclipse.jdt.core.tests.model/pom.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-  Copyright (c) 2012 Eclipse Foundation.
+  Copyright (c) 2012, 2013 Eclipse Foundation and others.
   All rights reserved. This program and the accompanying materials
   are made available under the terms of the Eclipse Distribution License v1.0
   which accompanies this distribution, and is available at
@@ -18,7 +18,7 @@
     <groupId>eclipse.jdt.core</groupId>
     <version>3.8.0-SNAPSHOT</version>
   </parent>
-  <groupId>eclipse.jdt.core</groupId>
+  <groupId>org.eclipse.jdt</groupId>
   <artifactId>org.eclipse.jdt.core.tests.model</artifactId>
   <version>3.8.2-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java
index e67367d..9c28c59 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -66,6 +66,13 @@
 			this.workingCopy = null;
 		}
 	}
+	private void assertArrayEquals(int[] expectedAnnotationsSize,
+			int[] actualAnnotationsSize) {
+		assertEquals("wrong array size", expectedAnnotationsSize.length, actualAnnotationsSize.length);
+		for (int i = 0, max = expectedAnnotationsSize.length; i < max; i++) {
+			assertEquals("Wrong element at " + i, expectedAnnotationsSize[i], actualAnnotationsSize[i]);
+		}
+	}
 
 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=234609 BindingKey#toSignature() fails with key from createWilcardTypeBindingKey(..)
 	public void test234609() throws JavaModelException {
@@ -11452,5 +11459,72 @@
 			deleteProject(jp);
 		}
 	}
+	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=376440
+	public void testBug376440() throws JavaModelException {
+		String str =
+				"package p;\n" +
+				 "class X extends p.Z<String>{}\n" +
+				 "class X extends  p.Z<String> {}\n" +
+				 "class Z<T> {}\n";
+		this.workingCopy = getWorkingCopy("/Converter15/src/p/X.java", true/*resolve*/);
+		ASTNode node = buildAST(str,this.workingCopy, false);
 
+		assertNotNull("No node", node);
+		assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+		CompilationUnit compilationUnit = (CompilationUnit) node;
+		assertEquals("Invaid no of types", 3, compilationUnit.types().size());
+		TypeDeclaration typeDecl = (TypeDeclaration) compilationUnit.types().get(0);
+		Type type = typeDecl.getSuperclassType();
+		ITypeBinding bindingFromAST = type.resolveBinding();
+		assertNotNull("Binding should not be null", bindingFromAST);
+		typeDecl = (TypeDeclaration) compilationUnit.types().get(1);
+		type = typeDecl.getSuperclassType();
+		try {
+			bindingFromAST = type.resolveBinding();
+		} catch(Exception e) {
+			fail("Should not throw exception, should just return null binding");
+		}
+		assertNull("Binding should be null", bindingFromAST);
+	}
+	/*
+	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=398520
+	 */
+	public void testBug398520() throws CoreException {
+		String jarLocation = getWorkspacePath()+"Converter15/bins/bug398520.jar";
+		IJavaProject jp = createJavaProject("Bug398520", new String[]{"src"}, new String[]{"CONVERTER_JCL15_LIB", jarLocation}, "bin", "1.5");
+		try {
+			this.workingCopy = getWorkingCopy("/Bug398520/src/testBug398520/C.java", true/*resolve*/);
+			String contents =
+				"package testBug398520;\n" +
+				"import pack.*;\n" +
+				"public class C {\n" +
+				"	 public Object foo() {\n" +
+				"        return new T<String, String>().new C().new Iter(\"\", 0, null);\n" +
+				"    }\n" +
+				"}\n";
+			ASTNode node = buildAST(
+					contents,
+					this.workingCopy,
+					true);
+			assertNotNull("No node", node);
+			assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+			CompilationUnit compilationUnit = (CompilationUnit) node;
+			assertEquals("Got problems", 0, compilationUnit.getProblems().length);
+			ASTNode astNode = getASTNode(compilationUnit, 0, 0, 0);
+			assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, astNode.getNodeType());
+			ReturnStatement statement = (ReturnStatement) astNode;
+			Expression expression = statement.getExpression();
+			ClassInstanceCreation creation = (ClassInstanceCreation) expression;
+			IMethodBinding methodBinding = creation.resolveConstructorBinding();
+			int[] expectedAnnotationsSize = new int[] { 1, 0, 1};
+			int[] actualAnnotationsSize = new int[] {
+					methodBinding.getParameterAnnotations(0).length,
+					methodBinding.getParameterAnnotations(1).length,
+					methodBinding.getParameterAnnotations(2).length
+			};
+			assertArrayEquals(expectedAnnotationsSize, actualAnnotationsSize);
+		} finally {
+			deleteProject(jp);
+		}
+	}
 }
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterJavadocTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterJavadocTest.java
index f131b40..5990600 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterJavadocTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterJavadocTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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,8 @@
  *******************************************************************************/
 package org.eclipse.jdt.core.tests.dom;
 
-import java.io.*;
+import java.io.File;
+import java.io.IOException;
 import java.lang.reflect.Method;
 import java.text.NumberFormat;
 import java.util.ArrayList;
@@ -27,7 +28,44 @@
 import org.eclipse.jdt.core.JavaCore;
 import org.eclipse.jdt.core.JavaModelException;
 import org.eclipse.jdt.core.compiler.IProblem;
-import org.eclipse.jdt.core.dom.*;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTMatcher;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.ArrayType;
+import org.eclipse.jdt.core.dom.Block;
+import org.eclipse.jdt.core.dom.Comment;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.EnumConstantDeclaration;
+import org.eclipse.jdt.core.dom.EnumDeclaration;
+import org.eclipse.jdt.core.dom.Expression;
+import org.eclipse.jdt.core.dom.ExpressionStatement;
+import org.eclipse.jdt.core.dom.FieldDeclaration;
+import org.eclipse.jdt.core.dom.IBinding;
+import org.eclipse.jdt.core.dom.IPackageBinding;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.IfStatement;
+import org.eclipse.jdt.core.dom.Javadoc;
+import org.eclipse.jdt.core.dom.MemberRef;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.MethodInvocation;
+import org.eclipse.jdt.core.dom.MethodRef;
+import org.eclipse.jdt.core.dom.MethodRefParameter;
+import org.eclipse.jdt.core.dom.Name;
+import org.eclipse.jdt.core.dom.PackageDeclaration;
+import org.eclipse.jdt.core.dom.PrimitiveType;
+import org.eclipse.jdt.core.dom.QualifiedName;
+import org.eclipse.jdt.core.dom.ReturnStatement;
+import org.eclipse.jdt.core.dom.SimpleName;
+import org.eclipse.jdt.core.dom.SimpleType;
+import org.eclipse.jdt.core.dom.Statement;
+import org.eclipse.jdt.core.dom.TagElement;
+import org.eclipse.jdt.core.dom.TextElement;
+import org.eclipse.jdt.core.dom.Type;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.eclipse.jdt.core.dom.TypeDeclarationStatement;
+import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
+import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
 import org.eclipse.jdt.internal.compiler.parser.ScannerHelper;
 
 /**
@@ -109,7 +147,17 @@
 	 * @param name
 	 */
 	public ASTConverterJavadocTest(String name) {
-		this(name, JavaCore.ENABLED, UNIX_SUPPORT);
+		this(name.substring(0, name.indexOf(" - ")),
+				name.substring(name.indexOf(" - Doc ") + 7, name.lastIndexOf("abled") + 5),
+				name.indexOf(" - Unix") != -1 ? "true" : "false");
+	}
+
+	/* (non-Javadoc)
+	 * @see junit.framework.TestCase#getName()
+	 */
+	public String getName() {
+		String strUnix = this.unix ? " - Unix" : "";
+		return super.getName()+" - Doc "+this.docCommentSupport+strUnix;
 	}
 
 	public static Test suite() {
@@ -175,13 +223,6 @@
 		}
 	}
 	/* (non-Javadoc)
-	 * @see junit.framework.TestCase#getName()
-	 */
-	public String getName() {
-		String strUnix = this.unix ? " - Unix" : "";
-		return "Doc "+this.docCommentSupport+strUnix+" - "+super.getName();
-	}
-	/* (non-Javadoc)
 	 * @see junit.framework.TestCase#setUp()
 	 */
 	protected void setUp() throws Exception {
@@ -3299,4 +3340,33 @@
 		ICompilationUnit unit = getCompilationUnit("Converter" , "src", "javadoc.testBug336821", "Try.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
 		verifyComments(unit);
 	}
+	
+	public void testBug347100() throws Exception {
+		ICompilationUnit unit = getCompilationUnit("Converter" , "src", "javadoc.testBug347100", "X.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+		CompilationUnit compilUnit = verifyComments(unit);
+		if (this.docCommentSupport.equals(JavaCore.ENABLED)) {
+			Javadoc comment = (Javadoc) compilUnit.getCommentList().get(0);
+			List tags = comment.tags();
+			assertEquals(4, tags.size());
+			
+			List mainTags = ((TagElement) tags.get(0)).fragments();
+			assertEquals(8, mainTags.size());
+			
+			TagElement link1 = (TagElement) mainTags.get(1);
+			assertEquals(TagElement.TAG_LINK, link1.getTagName());
+			SimpleName javadocRef = (SimpleName) link1.fragments().get(0);
+			assertTrue(javadocRef.resolveBinding() instanceof IPackageBinding);
+			link1.subtreeMatch(new ASTMatcher(true), tags.get(1));
+			
+			TagElement link2 = (TagElement) mainTags.get(4);
+			assertEquals(TagElement.TAG_LINK, link2.getTagName());
+			TextElement stringRef = (TextElement) link2.fragments().get(0);
+			assertEquals(" \"Hello World\"", stringRef.getText());
+			link2.subtreeMatch(new ASTMatcher(true), tags.get(2));
+			
+			TagElement link3 = (TagElement) mainTags.get(7);
+			assertEquals(TagElement.TAG_LINK, link3.getTagName());
+			link3.subtreeMatch(new ASTMatcher(true), tags.get(3));
+		}
+	}
 }
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java
index 381d8f2..076cb30 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java
@@ -92,6 +92,7 @@
 			this.deleteProject("Converter16"); //$NON-NLS-1$
 			this.deleteProject("Converter17"); //$NON-NLS-1$
 			this.deleteProject("Converter18"); //$NON-NLS-1$
+			PROJECT_SETUP = false;
 		} else {
 			TEST_SUITES.remove(getClass());
 			if (TEST_SUITES.size() == 0) {
@@ -100,6 +101,7 @@
 				this.deleteProject("Converter16"); //$NON-NLS-1$
 				this.deleteProject("Converter17"); //$NON-NLS-1$
 				this.deleteProject("Converter18"); //$NON-NLS-1$
+				PROJECT_SETUP = false;
 			}
 		}
 
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java
index b6cc47e..7081abc 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -1183,6 +1183,27 @@
 			}
 		}
 	}
+	protected IFile createFile(String path, InputStream content) throws CoreException {
+		IFile file = getFile(path);
+		file.create(content, true, null);
+		try {
+			content.close();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return file;
+	}
+
+	protected IFile createFile(String path, byte[] content) throws CoreException {
+		return createFile(path, new ByteArrayInputStream(content));
+	}
+
+	protected IFile createFile(String path, String content) throws CoreException {
+		return createFile(path, content.getBytes());
+	}
+	protected IFolder createFolder(String path) throws CoreException {
+		return createFolder(new Path(path));
+	}
 	protected IFolder createFolder(IPath path) throws CoreException {
 		final IFolder folder = getWorkspaceRoot().getFolder(path);
 		getWorkspace().run(new IWorkspaceRunnable() {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AttachedJavadocTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AttachedJavadocTests.java
index fdadfe7..d5d2351 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AttachedJavadocTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AttachedJavadocTests.java
@@ -10,6 +10,7 @@
  *******************************************************************************/
 package org.eclipse.jdt.core.tests.model;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URI;
@@ -369,7 +370,14 @@
 		assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$
 		IClassFile classFile = packageFragment.getClassFile("W.class"); //$NON-NLS-1$
 		assertNotNull(classFile);
-		String javadoc = classFile.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$
+		String javadoc = null;
+		try {
+			javadoc = classFile.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$
+		} catch(JavaModelException jme) {
+			if (!(jme.getCause() instanceof FileNotFoundException)) {
+				fail("Can only throw a FileNotFoundException");
+			}
+		}
 		assertNull("Should not have a javadoc", javadoc); //$NON-NLS-1$
 	}
 
@@ -1159,7 +1167,9 @@
 			String javadoc = packageFragment.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$
 			assertNull("Javadoc should be null", javadoc); //$NON-NLS-1$
 		} catch(JavaModelException jme) {
-			fail("Should not throw Java Model Exception");
+			if (!(jme.getCause() instanceof FileNotFoundException)) {
+				fail("Should not throw Java Model Exception");
+			}
 		}
 	}
 }
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java
index 452bc06..2b22377 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -4397,7 +4397,7 @@
 	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
 
 	assertResults(
-			"foo[METHOD_REF]{foo(), LCompletionAfterSupercall1_2;, ()V, foo, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_STATIC+ R_NON_RESTRICTED) + "}",
+			"foo[METHOD_REF]{foo(), LCompletionAfterSupercall1_2;, ()V, foo, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_STATIC+ R_NON_RESTRICTED + R_EXACT_NAME + R_METHOD_OVERIDE) + "}",
 			requestor.getResults());
 }
 public void testCompletionAfterSwitch() throws JavaModelException {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests2.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests2.java
index c2b7869..96c1913 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests2.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests2.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -6047,4 +6047,57 @@
 		fail("Invalid completion context");
 	}
 }
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=392581
+public void testBug392581() throws CoreException {
+	try {
+		// Create project and jar
+		IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin");
+		createFolder("/P/src/p");
+		refresh(p);
+		// Create working copy
+		this.workingCopies = new ICompilationUnit[1];
+		this.workingCopies[0] = getWorkingCopy(
+				"/P/src/p/B.java",
+				"class A {\n" +
+				"	protected String foo1(){\n" +
+				"		return \"From A\";\n" +
+				"  }\n" +
+				"}\n" +
+				"public class B extends A {\n" +
+				"	@Override\n" +
+				"	protected String foo1() {\n" +
+				"  		super. \n" +
+				"	}\n" +
+				"}");
+
+		// do completion
+		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+		requestor.setRequireExtendedContext(true);
+		requestor.setComputeVisibleElements(true);
+		requestor.allowAllRequiredProposals();
+		NullProgressMonitor monitor = new NullProgressMonitor();
+
+	    String str = this.workingCopies[0].getSource();
+	    String completeBehind = "super.";
+	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
+	    this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor);
+	    
+	    assertResults(
+	    	"clone[METHOD_REF]{clone(), Ljava.lang.Object;, ()Ljava.lang.Object;, clone, null, "+ (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}\n"
+	    	+ "equals[METHOD_REF]{equals(), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+ (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}\n"
+	    	+ "finalize[METHOD_REF]{finalize(), Ljava.lang.Object;, ()V, finalize, null, "+ (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}\n"
+	    	+ "getClass[METHOD_REF]{getClass(), Ljava.lang.Object;, ()Ljava.lang.Class;, getClass, null, "+ (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}\n"
+	    	+ "hashCode[METHOD_REF]{hashCode(), Ljava.lang.Object;, ()I, hashCode, null, "+ (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}\n"
+	    	+ "notify[METHOD_REF]{notify(), Ljava.lang.Object;, ()V, notify, null, "+ (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}\n"
+	    	+ "notifyAll[METHOD_REF]{notifyAll(), Ljava.lang.Object;, ()V, notifyAll, null, "+ (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}\n"
+	    	+ "toString[METHOD_REF]{toString(), Ljava.lang.Object;, ()Ljava.lang.String;, toString, null, "+ (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}\n"
+	    	+ "wait[METHOD_REF]{wait(), Ljava.lang.Object;, ()V, wait, null, "+ (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}\n"
+	    	+ "wait[METHOD_REF]{wait(), Ljava.lang.Object;, (J)V, wait, (millis), "+ (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}\n"
+	    	+ "wait[METHOD_REF]{wait(), Ljava.lang.Object;, (JI)V, wait, (millis, nanos), "+ (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}\n"
+	    	+ "foo1[METHOD_REF]{foo1(), Lp.A;, ()Ljava.lang.String;, foo1, null, "+ (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_EXACT_NAME + R_METHOD_OVERIDE) + "}",
+	    	requestor.getResults());
+	} finally {
+		deleteProject("P");
+	}
+}
 }
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SelectionJavadocModelTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SelectionJavadocModelTests.java
index 7cb2752..f7ccb14 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SelectionJavadocModelTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SelectionJavadocModelTests.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -1537,4 +1537,75 @@
 			elements
 		);
 	}
+	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=400767
+	public void testBug400767() throws Exception {
+		String content = "package test;\n"
+				+ "import b400767.ETest;\n"
+				+ "public class Bug {\n"
+				+ "	Bug() {\n"
+				+ "		doSomethingUsingOtherPackage();\n"
+				+ "	}\n"
+				+ "	public void addComponentListener(ComponentListener listener) {}\n"
+				+ "	private void doSomethingUsingOtherPackage() {\n"
+				+ "		for (ETest val : ETest.values()) {\n"
+				+ "			System.out.println(val.name());\n"
+				+ "		}\n"
+				+ "		Bug bug = new Bug();\n"
+				+ "		bug.addComponentListener(new ComponentAdapter() {\n"
+				+ "			/**\n"
+				+ "			 * @see ComponentAdapter#componentShown(ComponentEvent)\n"
+				+ "			 */\n"
+				+ "			@Override\n"
+				+ "			public void componentShown(ComponentEvent e) {\n"
+				+ "				super.componentShown(e);\n"
+				+ "			}\n"
+				+ "		});\n"
+				+ "	}\n"
+				+ "}\n"
+				+ "interface ComponentListener {\n"
+				+ "    public void componentShown(ComponentEvent e);\n"
+				+ "}\n"
+				+ "class ComponentAdapter implements ComponentListener {\n"
+				+ "	public void componentShown(ComponentEvent e) { }\n"
+				+ "}\n"
+				+ "class ComponentEvent {}";
+		this.wcOwner = new WorkingCopyOwner() {};
+		this.workingCopies = new ICompilationUnit[3];
+		this.workingCopies[2] =  getWorkingCopy("/Tests/test/ETest.java", content);
+		content = "/**\n "
+				+ "* This package is used by another package and will cause an error.\n"
+				+ " */\n"
+				+ "package b400767;";
+		// package-info is physically required at some point. Just put it to move forward.
+		createFolder("/Tests/b400767");
+		createFile("/Tests/b400767/package-info.java", content);
+		this.workingCopies[0] = getWorkingCopy("/Tests/b400767/package-info.java", content);
+		content = "package b400767;\n"
+				+ "public enum ETest {\n"
+				+ "	VAL1, VAL2, VAL3;\n"
+				+ "}";
+		this.workingCopies[1] = getWorkingCopy("/Tests/b400767/ETest.java", content);
+		final IJavaElement[] selection = new IJavaElement[1];
+		final ICompilationUnit[] copy = this.workingCopies;
+		Thread t = new Thread(new Runnable() {
+			public void run() {
+				try {
+					selection[0] = selectMethod(copy[2], "componentShown");
+				} catch (JavaModelException e) {
+					e.printStackTrace();
+					fail("Shouldn't be an exception");
+				}
+			}
+		});
+		t.start();
+		try {
+			Thread.sleep(500);
+		} catch (InterruptedException e) {
+		}
+		if (t.isAlive()) {
+			fail("Thread shouldn't still be running");
+		}
+		assertElementEquals("Should return a valid element", 
+							"componentShown(ComponentEvent) [in ComponentAdapter [in [Working copy] ETest.java [in test [in <project root> [in Tests]]]]]", selection[0]);
+	}
 }
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java
index cd9e0d4..88182d0 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -102,7 +102,7 @@
 protected void setUp() throws Exception {
 	super.setUp();
 	reset();
-	this.setUpJavaProject("TypeHierarchyNotification");
+	this.setUpJavaProject("TypeHierarchyNotification", "1.5");
 }
 static {
 //	TESTS_NAMES= new String[] { "testAddExtendsSourceType3" };
@@ -258,6 +258,39 @@
 	}
 }
 /**
+ * When a CU is added the type hierarchy should change
+ * only if one of the types of the CU is part of the
+ * type hierarchy. Tests parameterized supertype, see https://bugs.eclipse.org/401726
+ */
+public void testAddCompilationUnit4() throws CoreException {
+	IJavaProject javaProject = getJavaProject("TypeHierarchyNotification");
+	IType collection= javaProject.findType("java.util.Collection");
+	ITypeHierarchy h = collection.newTypeHierarchy(javaProject, null);
+	h.addTypeHierarchyChangedListener(this);
+
+	// a cu with a top level type which is part of the hierarchy
+	IPackageFragment pkg = getPackageFragment("TypeHierarchyNotification", "src", "p");
+	ICompilationUnit newCU2 = pkg.createCompilationUnit(
+		"Z2.java",
+		"package p;\n" +
+		"\n" +
+		"public abstract class Z2 extends java.util.Collection<java.lang.String> {\n" +
+		"}\n",
+		false,
+		null);
+	try {
+		assertCreation(newCU2);
+		assertOneChange(h);
+		h.refresh(null);
+		IType[] subtypes = h.getSubtypes(collection);
+		assertTrue("Should be one subtype of Collection", subtypes.length == 1);
+		assertEquals("Subtype of Collection should be p.Z2", newCU2.getType("Z2"), subtypes[0]);
+	} finally {
+		// cleanup
+		h.removeTypeHierarchyChangedListener(this);
+	}
+}
+/**
  * When a CU is added, if the type hierarchy doesn't have a focus, it should change
  * only if one of the types of the CU is part of the region.
  */
@@ -330,7 +363,7 @@
 			assertCreation(newCU3);
 			assertOneChange(h);
 			h.refresh(null);
-			IType throwableClass = getClassFile("TypeHierarchyNotification", getExternalJCLPathString(), "java.lang", "Throwable.class").getType();
+			IType throwableClass = getClassFile("TypeHierarchyNotification", getExternalJCLPathString("1.5"), "java.lang", "Throwable.class").getType();
 			assertEquals("Superclass of Z3 should be java.lang.Throwable", throwableClass, h.getSuperclass(newCU3.getType("Z3")));
 		} finally {
 			// cleanup
@@ -1394,11 +1427,12 @@
 public void testBug316654_b() throws CoreException {
 	IJavaProject project = getJavaProject("TypeHierarchyNotification");
 	refreshExternalArchives(project);
-	File jarFile = new File(getExternalJCLPathString());
+	String externalJCLPathString = getExternalJCLPathString("1.5");
+	File jarFile = new File(externalJCLPathString);
 	long oldTimestamp = jarFile.lastModified();
 	assertTrue("File does not exist", jarFile.exists());
 
-	IType throwableClass = getClassFile("TypeHierarchyNotification", getExternalJCLPathString(), "java.lang", "Throwable.class").getType();
+	IType throwableClass = getClassFile("TypeHierarchyNotification", externalJCLPathString, "java.lang", "Throwable.class").getType();
 	ITypeHierarchy h = throwableClass.newTypeHierarchy(project, null);
 	h.addTypeHierarchyChangedListener(this);
 	reset();
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java
index a0f688e..b24bf98 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -8,6 +8,7 @@
  * Contributors:
  *     IBM Corporation - initial API and implementation
  *     Stephan Herrmann - contribution for Bug 300576 - NPE Computing type hierarchy when compliance doesn't match libraries
+ *     Jesper S Moller - contributions for bug 393192 - Incomplete type hierarchy with > 10 annotations
  *******************************************************************************/
 package org.eclipse.jdt.core.tests.model;
 
@@ -15,6 +16,8 @@
 import java.io.IOException;
 import java.util.HashMap;
 
+import junit.framework.Test;
+
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IncrementalProjectBuilder;
@@ -22,14 +25,23 @@
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.OperationCanceledException;
 import org.eclipse.core.runtime.Path;
-
-import org.eclipse.jdt.core.*;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IClassFile;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IRegion;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
 import org.eclipse.jdt.core.tests.model.SearchTests.WaitingJob;
 import org.eclipse.jdt.core.tests.model.Semaphore.TimeOutException;
 import org.eclipse.jdt.core.tests.util.Util;
 
-import junit.framework.Test;
-
 public class TypeHierarchyTests extends ModifyingResourceTests {
 	/**
 	 * A placeholder for a type hierarchy used in some test cases.
@@ -2604,4 +2616,91 @@
 			deleteProject(prj);
 	}	
 }
-}
+//Bug 393192 -- Incomplete type hierarchy with > 10 annotations
+public void testBug393192() throws CoreException {
+	IJavaProject prj = null;
+	try {
+		prj = createJavaProject("Bug393192", new String[] {"src"}, new String[] {"JCL_LIB"}, "bin", "1.5");
+		createFolder("/Bug393192/src/pullup");
+		createFile("/Bug393192/src/pullup/A.java",
+				"package pullup;\n" + 
+				"\n" + 
+				"class A {\n" + 
+				"    @Deprecated\n" + 
+				"    void m0() {\n" + 
+				"    }\n" + 
+				"\n" + 
+				"    @Deprecated\n" + 
+				"    void m1() {\n" + 
+				"    }\n" + 
+				"\n" + 
+				"    @Deprecated\n" + 
+				"    void m2() {\n" + 
+				"    }\n" + 
+				"\n" + 
+				"    @Deprecated\n" + 
+				"    void m3() {\n" + 
+				"    }\n" + 
+				"\n" + 
+				"    @Deprecated\n" + 
+				"    void m4() {\n" + 
+				"    }\n" + 
+				"\n" + 
+				"    @Deprecated\n" + 
+				"    void m5() {\n" + 
+				"    }\n" + 
+				"\n" + 
+				"    @Deprecated\n" + 
+				"    void m6() {\n" + 
+				"    }\n" + 
+				"\n" + 
+				"    @Deprecated\n" + 
+				"    void m7() {\n" + 
+				"    }\n" + 
+				"\n" + 
+				"    @Deprecated\n" + 
+				"    void m8() {\n" + 
+				"    }\n" + 
+				"\n" + 
+				"    @Deprecated\n" + 
+				"    void m9() {\n" + 
+				"    }\n" + 
+				"\n" + 
+				"    /**\n" + 
+				"     * @param\n" + 
+				"     */\n" + 
+				"    @Deprecated\n" + 
+				"    void m10() {\n" + 
+				"    }\n" + 
+				"}\n" + 
+				"\n");
+		createFile("/Bug393192/src/pullup/package-info.java",
+				"package pullup;\n" + 
+				"\n");
+		createFile("/Bug393192/src/pullup/PullUpBug.java",
+				"package pullup;\n" + 
+				"\n" + 
+				"class PullUpBug extends A {\n" + 
+				"\n" + 
+				"    void mb() {\n" + 
+				"        pullUp();\n" + 
+				"    }\n" + 
+				"\n" + 
+				"    // INVOKE Pull Up REFACTORING ON \"pullUp\", or type Hierarchy on A\n" + 
+				"    private void pullUp() {\n" + 
+				"    }\n" + 
+				"}\n");
+		IType a = getCompilationUnit("Bug393192", "src", "pullup", "A.java").getType("A");
+		ITypeHierarchy hierarchy = a.newTypeHierarchy(new NullProgressMonitor());
+		assertHierarchyEquals(
+				"Focus: A [in A.java [in pullup [in src [in Bug393192]]]]\n" + 
+				"Super types:\n" + 
+				"  Object [in Object.class [in java.lang [in "+ getExternalJCLPathString() + "]]]\n" +
+				"Sub types:\n" +
+				"  PullUpBug [in PullUpBug.java [in pullup [in src [in Bug393192]]]]\n",
+				hierarchy);
+	} finally {
+		if (prj != null)
+			deleteProject(prj);
+	}	
+}}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/src/javadoc/testBug347100/X.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/src/javadoc/testBug347100/X.java
new file mode 100644
index 0000000..33df576
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Converter/src/javadoc/testBug347100/X.java
@@ -0,0 +1,12 @@
+package javadoc.testBug347100;
+/**
+ * Link to {@link javadoc},<br>
+ * link to {@link "Hello World"},<br>
+ * and {@link <a href="../package-summary.html">package documentation</a>}
+ * 
+ * @see javadoc
+ * @see "Hello World"
+ * @see <a href="../package-summary.html">package documentation</a>
+ */
+public class X {
+}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter15/bins/bug398520.jar b/org.eclipse.jdt.core.tests.model/workspace/Converter15/bins/bug398520.jar
new file mode 100644
index 0000000..6f8d8bd
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Converter15/bins/bug398520.jar
Binary files differ
diff --git a/org.eclipse.jdt.core/.settings/.api_filters b/org.eclipse.jdt.core/.settings/.api_filters
new file mode 100644
index 0000000..fdfa23c
--- /dev/null
+++ b/org.eclipse.jdt.core/.settings/.api_filters
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?><component id="org.eclipse.jdt.core" version="2">
+    <resource path="model/org/eclipse/jdt/core/IAccessRule.java" type="org.eclipse.jdt.core.IAccessRule">
+        <filter id="403853384">
+            <message_arguments>
+                <message_argument value="org.eclipse.jdt.core.IAccessRule"/>
+            </message_arguments>
+        </filter>
+    </resource>
+    <resource path="model/org/eclipse/jdt/core/IAnnotatable.java" type="org.eclipse.jdt.core.IAnnotatable">
+        <filter id="403853384">
+            <message_arguments>
+                <message_argument value="org.eclipse.jdt.core.IAnnotatable"/>
+            </message_arguments>
+        </filter>
+    </resource>
+    <resource path="model/org/eclipse/jdt/core/IAnnotation.java" type="org.eclipse.jdt.core.IAnnotation">
+        <filter id="403853384">
+            <message_arguments>
+                <message_argument value="org.eclipse.jdt.core.IAnnotation"/>
+            </message_arguments>
+        </filter>
+    </resource>
+</component>
\ No newline at end of file
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
index 82402e5..4c06b84 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
@@ -28,7 +28,7 @@
 
 ###{ObjectTeams:
 otdtc.name = Extension for Object Teams
-otdtc.version = 2.2.0 M5
+otdtc.version = 2.2.0 M6
 otdtc.copyright = Copyright by TU Berlin, Fraunhofer FIRST and others, 2004, 2013.
 ### SH}
 ### progress
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
index 0c36b5c..3bd6108 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -4402,6 +4402,27 @@
 		return 0;
 	}
 
+	private int computeRelevanceForSuper(MethodBinding method, Scope scope, InvocationSite site) {
+		if (site instanceof CompletionOnMemberAccess) {
+			CompletionOnMemberAccess access = (CompletionOnMemberAccess) site;
+			if (access.isSuperAccess() && this.parser.assistNodeParent == null) {
+				ReferenceContext referenceContext = scope.referenceContext();
+				if (referenceContext instanceof AbstractMethodDeclaration) {
+					MethodBinding binding = ((AbstractMethodDeclaration) referenceContext).binding;
+					if (binding != null) {
+						if (CharOperation.equals(binding.selector, method.selector)) {
+							if (binding.areParameterErasuresEqual(method)) {
+								return R_EXACT_NAME + R_METHOD_OVERIDE;
+							}
+							return R_EXACT_NAME;
+						}
+					}
+				}
+			}
+		}
+		return 0;
+	}
+
 	private long computeTargetedElement(CompletionOnAnnotationOfType fakeNode) {
 		ASTNode annotatedElement = fakeNode.potentialAnnotatedNode;
 
@@ -9130,7 +9151,7 @@
 			if (missingElements != null) {
 				relevance += computeRelevanceForMissingElements(missingElementsHaveProblems);
 			}
-
+			relevance += computeRelevanceForSuper(method, scope, invocationSite);
 			this.noProposal = false;
 
 			if (castedReceiver == null) {
@@ -14216,4 +14237,4 @@
 		return completion;
 	}
 // SH}
-}
\ No newline at end of file
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java
index 6665469..007f983 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java
@@ -179,6 +179,10 @@
  *									DereferencingNullableExpression
  *									NullityMismatchingTypeAnnotation
  *									NullityMismatchingTypeAnnotationUnchecked
+ *									PotentialNullUnboxing
+ *									NullUnboxing
+ *									NullExpressionReference
+ *									PotentialNullExpressionReference
  *      Jesper S Moller  - added the following constants
  *									TargetTypeNotAFunctionalInterface
  *									OuterLocalMustBeEffectivelyFinal
@@ -946,6 +950,10 @@
 	int RedundantNullCheckOnNonNullLocalVariable = Internal + 457;
 	/** @since 3.3 */
 	int NonNullLocalVariableComparisonYieldsFalse = Internal + 458;
+	/** @since 3.9 */
+	int PotentialNullUnboxing = Internal + 459;
+	/** @since 3.9 */
+	int NullUnboxing = Internal + 461;
 
 	// block
 	/** @since 3.0 */
@@ -1417,6 +1425,10 @@
 	int NonNullExpressionComparisonYieldsFalse = Internal + 670;
 	/** @since 3.9 */
 	int RedundantNullCheckOnNonNullExpression = Internal + 671;
+	/** @since 3.9 */
+	int NullExpressionReference = Internal + 672;
+	/** @since 3.9 */
+	int PotentialNullExpressionReference = Internal + 673;
 
 	/**
 	 * Corrupted binaries
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java
index f2333ca..2d39785 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java
@@ -19,6 +19,8 @@
  *								bug 345305 - [compiler][null] Compiler misidentifies a case of "variable can only be null"
  *								bug 395002 - Self bound generic class doesn't resolve bounds properly for wildcards for certain parametrisation.
  *								bug 383368 - [compiler][null] syntactic null analysis for field references
+ *								bug 401017 - [compiler][null] casted reference to @Nullable field lacks a warning
+ *								bug 400761 - [compiler][null] null may be return as boolean without a diagnostic
  *******************************************************************************/
 package org.eclipse.jdt.internal.compiler.ast;
 
@@ -152,9 +154,7 @@
 	FlowInfo result = this.expression
 		.analyseCode(currentScope, flowContext, flowInfo)
 		.unconditionalInits();
-	if ((this.expression.implicitConversion & TypeIds.UNBOXING) != 0) {
-		this.expression.checkNPE(currentScope, flowContext, flowInfo);
-	}
+	this.expression.checkNPEbyUnboxing(currentScope, flowContext, flowInfo);
 	// account for pot. CCE:
 	flowContext.recordAbruptExit();
 	return result;
@@ -344,6 +344,11 @@
 	}
 }
 
+public boolean checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo) {
+	checkNPEbyUnboxing(scope, flowContext, flowInfo);
+	return this.expression.checkNPE(scope, flowContext, flowInfo);
+}
+
 private static void checkAlternateBinding(BlockScope scope, Expression receiver, TypeBinding receiverType, MethodBinding binding, Expression[] arguments, TypeBinding[] originalArgumentTypes, TypeBinding[] alternateArgumentTypes, final InvocationSite invocationSite) {
 		InvocationSite fakeInvocationSite = new InvocationSite(){
 			public TypeBinding[] genericTypeArguments() { return null; }
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java
index 224ae40..c892b9d 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java
@@ -19,6 +19,7 @@
  *     						bug 349326 - [1.7] new warning for missing try-with-resources
  *							bug 345305 - [compiler][null] Compiler misidentifies a case of "variable can only be null"
  *							bug 383368 - [compiler][null] syntactic null analysis for field references
+ *							bug 400761 - [compiler][null] null may be return as boolean without a diagnostic
  *******************************************************************************/
 package org.eclipse.jdt.internal.compiler.ast;
 
@@ -84,6 +85,7 @@
 		}
 		this.trueInitStateIndex = currentScope.methodScope().recordInitializationStates(trueFlowInfo);
 		trueFlowInfo = this.valueIfTrue.analyseCode(currentScope, flowContext, trueFlowInfo);
+		this.valueIfTrue.checkNPEbyUnboxing(currentScope, flowContext, trueFlowInfo);
 
 		// may need to fetch this null status before expireNullCheckedFieldInfo():
 		int preComputedTrueNullStatus = -1;
@@ -105,6 +107,7 @@
 		}
 		this.falseInitStateIndex = currentScope.methodScope().recordInitializationStates(falseFlowInfo);
 		falseFlowInfo = this.valueIfFalse.analyseCode(currentScope, flowContext, falseFlowInfo);
+		this.valueIfFalse.checkNPEbyUnboxing(currentScope, flowContext, falseFlowInfo);
 
 		flowContext.conditionalLevel--;
 		
@@ -175,6 +178,14 @@
 		return mergedInfo;
 	}
 
+	public boolean checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo) {
+		if ((this.nullStatus & FlowInfo.NULL) != 0)
+			scope.problemReporter().expressionNullReference(this);
+		else if ((this.nullStatus & FlowInfo.POTENTIALLY_NULL) != 0)
+			scope.problemReporter().expressionPotentialNullReference(this);
+		return true; // all checking done
+	}
+
 	private void computeNullStatus(int ifTrueNullStatus, FlowInfo trueBranchInfo, FlowInfo falseBranchInfo, FlowContext flowContext) {
 		// given that the condition cannot be optimized to a constant 
 		// we now merge the nullStatus from both branches:
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
index f376496..d1677e4 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
@@ -18,6 +18,7 @@
  *								bug 383690 - [compiler] location of error re uninitialized final field should be aligned
  *								bug 331649 - [compiler][null] consider null annotations for fields
  *								bug 383368 - [compiler][null] syntactic null analysis for field references
+ *								bug 400421 - [compiler] Null analysis for fields does not take @com.google.inject.Inject into account
  *******************************************************************************/
 package org.eclipse.jdt.internal.compiler.ast;
 
@@ -320,10 +321,12 @@
 									? (ASTNode) this.scope.referenceType().declarationOf(field.original())
 									: this);
 					} else if (field.isNonNull()) {
+						FieldDeclaration fieldDecl = this.scope.referenceType().declarationOf(field.original());
+						if (!isValueProvidedUsingAnnotation(fieldDecl))
 							this.scope.problemReporter().uninitializedNonNullField(
 								field,
 								((this.bits & ASTNode.IsDefaultConstructor) != 0) 
-									? (ASTNode) this.scope.referenceType().declarationOf(field.original())
+									? (ASTNode) fieldDecl
 									: this);
 					}
 				}
@@ -339,6 +342,29 @@
 	}
 }
 
+boolean isValueProvidedUsingAnnotation(FieldDeclaration fieldDecl) {
+	// a member field annotated with @Inject is considered to be initialized by the injector 
+	if (fieldDecl.annotations != null) {
+		int length = fieldDecl.annotations.length;
+		for (int i = 0; i < length; i++) {
+			Annotation annotation = fieldDecl.annotations[i];
+			if (annotation.resolvedType.id == TypeIds.T_JavaxInjectInject) {
+				return true; // no concept of "optional"
+			} else if (annotation.resolvedType.id == TypeIds.T_ComGoogleInjectInject) {
+				MemberValuePair[] memberValuePairs = annotation.memberValuePairs();
+				if (memberValuePairs == Annotation.NoValuePairs)
+					return true;
+				for (int j = 0; j < memberValuePairs.length; j++) {
+					// if "optional=false" is specified, don't rely on initialization by the injector:
+					if (CharOperation.equals(memberValuePairs[j].name, TypeConstants.OPTIONAL))
+						return memberValuePairs[j].value instanceof FalseLiteral;
+				}
+			}
+		}
+	}
+	return false;
+}
+
 /**
  * Bytecode generation for a constructor
  *
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java
index d3c3303..ad9a6a8 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -11,6 +11,7 @@
  *								bug 186342 - [compiler][null] Using annotations for null checking
  *								bug 331649 - [compiler][null] consider null annotations for fields
  *								bug 383368 - [compiler][null] syntactic null analysis for field references
+ *								bug 382069 - [null] Make the null analysis consider JUnit's assertNotNull similarly to assertions
  *******************************************************************************/
 package org.eclipse.jdt.internal.compiler.ast;
 
@@ -46,6 +47,7 @@
 			rightNonNullChecked = scope.problemReporter().expressionNonNullComparison(this.right, checkEquality);
 		}
 		
+		boolean contextualCheckEquality = checkEquality ^ ((flowContext.tagBits & FlowContext.INSIDE_NEGATIVE_ASSERT) != 0);
 		// perform flowInfo-based checks for variables and record info for syntactic null analysis for fields:
 		if (!leftNonNullChecked) {
 			LocalVariableBinding local = this.left.localVariableBinding();
@@ -54,7 +56,8 @@
 					checkVariableComparison(scope, flowContext, flowInfo, initsWhenTrue, initsWhenFalse, local, rightStatus, this.left);
 				}
 			} else if (this.left instanceof Reference
-							&& ((!checkEquality && rightStatus == FlowInfo.NULL) || (checkEquality && rightStatus == FlowInfo.NON_NULL))
+							&& ((!contextualCheckEquality && rightStatus == FlowInfo.NULL) 
+									|| (contextualCheckEquality && rightStatus == FlowInfo.NON_NULL))
 							&& scope.compilerOptions().enableSyntacticNullAnalysisForFields)
 			{
 				FieldBinding field = ((Reference)this.left).lastFieldBinding();
@@ -70,7 +73,8 @@
 					checkVariableComparison(scope, flowContext, flowInfo, initsWhenTrue, initsWhenFalse, local, leftStatus, this.right);
 				}
 			} else if (this.right instanceof Reference
-							&& ((!checkEquality && leftStatus == FlowInfo.NULL) || (checkEquality && leftStatus == FlowInfo.NON_NULL))
+							&& ((!contextualCheckEquality && leftStatus == FlowInfo.NULL) 
+									|| (contextualCheckEquality && leftStatus == FlowInfo.NON_NULL))
 							&& scope.compilerOptions().enableSyntacticNullAnalysisForFields) 
 			{
 				FieldBinding field = ((Reference)this.right).lastFieldBinding();
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java
index 4b53d0f..5914dde 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java
@@ -20,6 +20,7 @@
  *								bug 392862 - [1.8][compiler][null] Evaluate null annotations on array types
  *								bug 331649 - [compiler][null] consider null annotations for fields
  *								bug 383368 - [compiler][null] syntactic null analysis for field references
+ *								bug 400761 - [compiler][null] null may be return as boolean without a diagnostic
  *******************************************************************************/
 package org.eclipse.jdt.internal.compiler.ast;
 
@@ -772,6 +773,17 @@
 	return false; // not checked
 }
 
+/** If this expression requires unboxing check if that operation can throw NPE. */
+protected void checkNPEbyUnboxing(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo) {
+	if ((this.implicitConversion & UNBOXING) != 0) {
+		int status = nullStatus(flowInfo, flowContext);
+		if ((status & FlowInfo.NULL) != 0)
+			scope.problemReporter().nullUnboxing(this, this.resolvedType);
+		else if ((status & FlowInfo.POTENTIALLY_NULL) != 0)
+			scope.problemReporter().potentialNullUnboxing(this, this.resolvedType);
+	}
+}
+
 public boolean checkUnsafeCast(Scope scope, TypeBinding castType, TypeBinding expressionType, TypeBinding match, boolean isNarrowing) {
 	if (match == castType) {
 		if (!isNarrowing) tagAsUnnecessaryCast(scope, castType);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java
index 453fda4..8186ac7 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java
@@ -16,6 +16,7 @@
  *     Stephan Herrmann - Contribution for
  *								bug 395002 - Self bound generic class doesn't resolve bounds properly for wildcards for certain parametrisation.
  *								bug 331649 - [compiler][null] consider null annotations for fields
+ *								bug 400761 - [compiler][null] null may be return as boolean without a diagnostic
  *******************************************************************************/
 package org.eclipse.jdt.internal.compiler.ast;
 
@@ -130,6 +131,7 @@
 				initializationScope.problemReporter().nullityMismatch(this.initialization, this.initialization.resolvedType, this.binding.type, nullStatus, annotationName);
 			}
 		}
+		this.initialization.checkNPEbyUnboxing(initializationScope, flowContext, flowInfo);
 	}
 	return flowInfo;
 }
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java
index 735cec1..b564288 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -14,6 +14,8 @@
  *								bug 185682 - Increment/decrement operators mark local variables as read
  *								bug 331649 - [compiler][null] consider null annotations for fields
  *								bug 383368 - [compiler][null] syntactic null analysis for field references
+ *     Jesper S Moller - Contributions for
+ *								Bug 378674 - "The method can be declared as static" is wrong
  *******************************************************************************/
 package org.eclipse.jdt.internal.compiler.ast;
 
@@ -195,12 +197,6 @@
 		if (this.receiver.isThis()) {
 			currentScope.resetDeclaringClassMethodStaticFlag(this.binding.declaringClass);
 		}
-	} else if (this.receiver.isThis()) {
-		if ((this.receiver.bits & ASTNode.IsImplicitThis) == 0) {
-			// explicit this receiver, not allowed in static context
-			// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
-			currentScope.resetEnclosingMethodStaticFlag();
-		}
 	}
 
 	if (valueRequired || currentScope.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_4) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java
index cb28d42..acfc3c5 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -14,6 +14,8 @@
  *								bug 365859 - [compiler][null] distinguish warnings based on flow analysis vs. null annotations
  *								bug 345305 - [compiler][null] Compiler misidentifies a case of "variable can only be null"
  *								bug 393719 - [compiler] inconsistent warnings on iteration variables
+ *     Jesper S Moller -  Contribution for
+ *								bug 401853 - Eclipse Java compiler creates invalid bytecode (java.lang.VerifyError)
  *******************************************************************************/
 package org.eclipse.jdt.internal.compiler.ast;
 
@@ -36,6 +38,7 @@
 import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
 import org.eclipse.jdt.internal.compiler.lookup.TagBits;
 import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
+import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
 import org.eclipse.objectteams.otdt.core.compiler.IOTConstants;
 import org.eclipse.objectteams.otdt.internal.core.compiler.control.Config;
 import org.eclipse.objectteams.otdt.internal.core.compiler.util.RoleTypeCreator;
@@ -331,7 +334,15 @@
 					}
 				}
 				if (this.elementVariable.binding.resolvedPosition == -1) {
-					codeStream.pop();
+					switch (this.elementVariable.binding.type.id) {
+						case TypeIds.T_long :
+						case TypeIds.T_double :
+							codeStream.pop2();
+							break;
+						default:
+							codeStream.pop();
+							break;
+					}
 				} else {
 					codeStream.store(this.elementVariable.binding, false);
 					codeStream.addVisibleLocalVariable(this.elementVariable.binding);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java
index f32aeac..0484b34 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java
@@ -26,6 +26,9 @@
  *							bug 394768 - [compiler][resource] Incorrect resource leak warning when creating stream in conditional
  *							bug 395002 - Self bound generic class doesn't resolve bounds properly for wildcards for certain parametrisation.
  *							bug 383368 - [compiler][null] syntactic null analysis for field references
+ *							bug 400761 - [compiler][null] null may be return as boolean without a diagnostic
+ *     Jesper S Moller - Contributions for
+ *							Bug 378674 - "The method can be declared as static" is wrong
  *******************************************************************************/
 package org.eclipse.jdt.internal.compiler.ast;
 
@@ -139,9 +142,7 @@
 	if (this.initialization == null) {
 		return flowInfo;
 	}
-	if ((this.initialization.implicitConversion & TypeIds.UNBOXING) != 0) {
-		this.initialization.checkNPE(currentScope, flowContext, flowInfo);
-	}
+	this.initialization.checkNPEbyUnboxing(currentScope, flowContext, flowInfo);
 	
 	FlowInfo preInitInfo = null;
 	boolean shouldAnalyseResource = this.binding != null 
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
index e8c79b6..653b8f9 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
@@ -4,7 +4,6 @@
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * $Id: MessageSend.java 23405 2010-02-03 17:02:18Z stephan $
  *
  * This is an implementation of an early-draft specification developed under the Java
  * Community Process (JCP) and is made available for testing and evaluation purposes
@@ -33,6 +32,9 @@
  *								bug 383368 - [compiler][null] syntactic null analysis for field references
  *								bug 382350 - [1.8][compiler] Unable to invoke inherited default method via I.super.m() syntax
  *								bug 404649 - [1.8][compiler] detect illegal reference to indirect or redundant super
+ *								bug 382069 - [null] Make the null analysis consider JUnit's assertNotNull similarly to assertions
+ *     Jesper S Moller - Contributions for
+ *								Bug 378674 - "The method can be declared as static" is wrong
  *******************************************************************************/
 package org.eclipse.jdt.internal.compiler.ast;
 
@@ -55,6 +57,7 @@
 import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
 import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
 import org.eclipse.jdt.internal.compiler.lookup.ImplicitNullAnnotationVerifier;
+import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
 import org.eclipse.jdt.internal.compiler.lookup.InvocationSite;
 import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
 import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
@@ -146,7 +149,6 @@
  * What: Work against signature weakening.
  * How:  Insert casts for return value if needed.
  *
- * @version $Id: MessageSend.java 23405 2010-02-03 17:02:18Z stephan $
  */
 public class MessageSend extends Expression implements InvocationSite {
 
@@ -216,14 +218,8 @@
 			// accessing non-static method without an object
 			currentScope.resetDeclaringClassMethodStaticFlag(this.actualReceiverType);
 		}
-	} else if (this.receiver.isThis()) {
-		if ((this.receiver.bits & ASTNode.IsImplicitThis) == 0) {
-			// explicit this receiver, not allowed in static context
-			currentScope.resetEnclosingMethodStaticFlag();
-		}
 	}
 
-	FlowInfo conditionFlowInfo;
 	if (this.arguments != null) {
 		int length = this.arguments.length;
 		for (int i = 0; i < length; i++) {
@@ -231,35 +227,20 @@
 			if ((argument.implicitConversion & TypeIds.UNBOXING) != 0) {
 				argument.checkNPE(currentScope, flowContext, flowInfo);
 			}
-			if (this.receiver.resolvedType != null 
-					&& this.receiver.resolvedType.id == TypeIds.T_OrgEclipseCoreRuntimeAssert
-					&& argument.resolvedType != null
-					&& argument.resolvedType.id == TypeIds.T_boolean) {
-				Constant cst = argument.optimizedBooleanConstant();
-				boolean isOptimizedTrueAssertion = cst != Constant.NotAConstant && cst.booleanValue() == true;
-				boolean isOptimizedFalseAssertion = cst != Constant.NotAConstant && cst.booleanValue() == false;
-				flowContext.tagBits |= FlowContext.HIDE_NULL_COMPARISON_WARNING;
-				conditionFlowInfo = argument.analyseCode(currentScope, flowContext, flowInfo.copy());
-				if (!wasInsideAssert) {
-					flowContext.tagBits &= ~FlowContext.HIDE_NULL_COMPARISON_WARNING;
-				}
-				UnconditionalFlowInfo assertWhenTrueInfo = conditionFlowInfo.initsWhenTrue().unconditionalInits();
-				FlowInfo assertInfo = conditionFlowInfo.initsWhenFalse();
-				if (isOptimizedTrueAssertion) {
-					assertInfo.setReachMode(FlowInfo.UNREACHABLE_OR_DEAD);
-				}
-				if (!isOptimizedFalseAssertion) {
-					// if assertion is not false for sure, only then it makes sense to carry the flow info ahead.
-					// if the code does reach ahead, it means the assert didn't cause an exit, and so
-					// the expression inside it shouldn't change the prior flowinfo
-					// viz. org.eclipse.core.runtime.Assert.isLegal(false && o != null)
-					
-					// keep the merge from the initial code for the definite assignment
-					// analysis, tweak the null part to influence nulls downstream
-					flowInfo = flowInfo.mergedWith(assertInfo.nullInfoLessUnconditionalCopy()).
-						addInitializationsFrom(assertWhenTrueInfo.discardInitializationInfo());
-				}
-			} else {
+			switch (detectAssertionUtility(i)) {
+				case TRUE_ASSERTION:
+					flowInfo = analyseBooleanAssertion(currentScope, argument, flowContext, flowInfo, wasInsideAssert, true);
+					break;
+				case FALSE_ASSERTION:
+					flowInfo = analyseBooleanAssertion(currentScope, argument, flowContext, flowInfo, wasInsideAssert, false);
+					break;
+				case NONNULL_ASSERTION:
+					flowInfo = analyseNullAssertion(currentScope, argument, flowContext, flowInfo, false);
+					break;
+				case NULL_ASSERTION:
+					flowInfo = analyseNullAssertion(currentScope, argument, flowContext, flowInfo, true);
+					break;
+				default:
 				flowInfo = argument.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
 			}
 			if (analyseResources) {
@@ -326,6 +307,153 @@
 	return flowInfo;
 }
 // SH}
+
+// classification of well-known assertion utilities:
+private static final int TRUE_ASSERTION = 1;
+private static final int FALSE_ASSERTION = 2;
+private static final int NULL_ASSERTION = 3;
+private static final int NONNULL_ASSERTION = 4;
+
+// is the argument at the given position being checked by a well-known assertion utility?
+// if so answer what kind of assertion we are facing.
+private int detectAssertionUtility(int argumentIdx) {
+	TypeBinding[] parameters = this.binding.original().parameters;
+	if (argumentIdx < parameters.length) {
+		TypeBinding parameterType = parameters[argumentIdx];
+		if (this.actualReceiverType != null && parameterType != null) {
+			switch (this.actualReceiverType.id) {
+				case TypeIds.T_OrgEclipseCoreRuntimeAssert:
+					if (parameterType.id == TypeIds.T_boolean)
+						return TRUE_ASSERTION;
+					if (parameterType.id == TypeIds.T_JavaLangObject && CharOperation.equals(TypeConstants.IS_NOTNULL, this.selector))
+						return NONNULL_ASSERTION;
+					break;
+				case TypeIds.T_JunitFrameworkAssert:
+				case TypeIds.T_OrgJunitAssert:
+					if (parameterType.id == TypeIds.T_boolean) {
+						if (CharOperation.equals(TypeConstants.ASSERT_TRUE, this.selector))
+							return TRUE_ASSERTION;
+						if (CharOperation.equals(TypeConstants.ASSERT_FALSE, this.selector))
+							return FALSE_ASSERTION;
+					} else if (parameterType.id == TypeIds.T_JavaLangObject) {
+						if (CharOperation.equals(TypeConstants.ASSERT_NOTNULL, this.selector))
+							return NONNULL_ASSERTION;
+						if (CharOperation.equals(TypeConstants.ASSERT_NULL, this.selector))
+							return NULL_ASSERTION;
+					}
+					break;
+				case TypeIds.T_OrgApacheCommonsLangValidate:
+					if (parameterType.id == TypeIds.T_boolean) {
+						if (CharOperation.equals(TypeConstants.IS_TRUE, this.selector))
+							return TRUE_ASSERTION;
+					} else if (parameterType.id == TypeIds.T_JavaLangObject) {
+						if (CharOperation.equals(TypeConstants.NOT_NULL, this.selector))
+							return NONNULL_ASSERTION;
+					}
+					break;
+				case TypeIds.T_OrgApacheCommonsLang3Validate:
+					if (parameterType.id == TypeIds.T_boolean) {
+						if (CharOperation.equals(TypeConstants.IS_TRUE, this.selector))
+							return TRUE_ASSERTION;
+					} else if (parameterType.isTypeVariable()) {
+						if (CharOperation.equals(TypeConstants.NOT_NULL, this.selector))
+							return NONNULL_ASSERTION;
+					}
+					break;
+				case TypeIds.T_ComGoogleCommonBasePreconditions:
+					if (parameterType.id == TypeIds.T_boolean) {
+						if (CharOperation.equals(TypeConstants.CHECK_ARGUMENT, this.selector)
+							|| CharOperation.equals(TypeConstants.CHECK_STATE, this.selector))
+							return TRUE_ASSERTION;
+					} else if (parameterType.isTypeVariable()) {
+						if (CharOperation.equals(TypeConstants.CHECK_NOT_NULL, this.selector))
+							return NONNULL_ASSERTION;
+					}
+					break;					
+				case TypeIds.T_JavaUtilObjects:
+					if (parameterType.isTypeVariable()) {
+						if (CharOperation.equals(TypeConstants.REQUIRE_NON_NULL, this.selector))
+							return NONNULL_ASSERTION;
+					}
+					break;					
+			}
+		}
+	}
+	return 0;
+}
+private FlowInfo analyseBooleanAssertion(BlockScope currentScope, Expression argument,
+		FlowContext flowContext, FlowInfo flowInfo, boolean wasInsideAssert, boolean passOnTrue)
+{
+	Constant cst = argument.optimizedBooleanConstant();
+	boolean isOptimizedTrueAssertion = cst != Constant.NotAConstant && cst.booleanValue() == true;
+	boolean isOptimizedFalseAssertion = cst != Constant.NotAConstant && cst.booleanValue() == false;
+	int tagBitsSave = flowContext.tagBits;
+	flowContext.tagBits |= FlowContext.HIDE_NULL_COMPARISON_WARNING;
+	if (!passOnTrue)
+		flowContext.tagBits |= FlowContext.INSIDE_NEGATIVE_ASSERT; // this affects syntactic analysis for fields in EqualExpression
+	FlowInfo conditionFlowInfo = argument.analyseCode(currentScope, flowContext, flowInfo.copy());
+	flowContext.extendTimeToLiveForNullCheckedField(2); // survive this assert as a MessageSend and as a Statement
+	flowContext.tagBits = tagBitsSave;
+
+	UnconditionalFlowInfo assertWhenPassInfo;
+	FlowInfo assertWhenFailInfo;
+	boolean isOptimizedPassing;
+	boolean isOptimizedFailing;
+	if (passOnTrue) {
+		assertWhenPassInfo = conditionFlowInfo.initsWhenTrue().unconditionalInits();
+		assertWhenFailInfo = conditionFlowInfo.initsWhenFalse();
+		isOptimizedPassing = isOptimizedTrueAssertion;
+		isOptimizedFailing = isOptimizedFalseAssertion;
+	} else {
+		assertWhenPassInfo = conditionFlowInfo.initsWhenFalse().unconditionalInits();
+		assertWhenFailInfo = conditionFlowInfo.initsWhenTrue();
+		isOptimizedPassing = isOptimizedFalseAssertion;
+		isOptimizedFailing = isOptimizedTrueAssertion;
+	}
+	if (isOptimizedPassing) {
+		assertWhenFailInfo.setReachMode(FlowInfo.UNREACHABLE_OR_DEAD);
+	}
+	if (!isOptimizedFailing) {
+		// if assertion is not failing for sure, only then it makes sense to carry the flow info ahead.
+		// if the code does reach ahead, it means the assert didn't cause an exit, and so
+		// the expression inside it shouldn't change the prior flowinfo
+		// viz. org.eclipse.core.runtime.Assert.isLegal(false && o != null)
+		
+		// keep the merge from the initial code for the definite assignment
+		// analysis, tweak the null part to influence nulls downstream
+		flowInfo = flowInfo.mergedWith(assertWhenFailInfo.nullInfoLessUnconditionalCopy()).
+			addInitializationsFrom(assertWhenPassInfo.discardInitializationInfo());
+	}
+	return flowInfo;
+}
+private FlowInfo analyseNullAssertion(BlockScope currentScope, Expression argument,
+		FlowContext flowContext, FlowInfo flowInfo, boolean expectingNull)
+{
+	int nullStatus = argument.nullStatus(flowInfo, flowContext);
+	boolean willFail = (nullStatus == (expectingNull ? FlowInfo.NON_NULL : FlowInfo.NULL));
+	flowInfo = argument.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
+	LocalVariableBinding local = argument.localVariableBinding();
+	if (local != null) {// beyond this point the argument can only be null/nonnull
+		if (expectingNull) 
+			flowInfo.markAsDefinitelyNull(local);
+		else 
+			flowInfo.markAsDefinitelyNonNull(local);
+	} else {
+		if (!expectingNull
+			&& argument instanceof Reference 
+			&& currentScope.compilerOptions().enableSyntacticNullAnalysisForFields) 
+		{
+			FieldBinding field = ((Reference)argument).lastFieldBinding();
+			if (field != null && (field.type.tagBits & TagBits.IsBaseType) == 0) {
+				flowContext.recordNullCheckedFieldReference((Reference) argument, 3); // survive this assert as a MessageSend and as a Statement
+			}
+		}
+	}
+	if (willFail)
+		flowInfo.setReachMode(FlowInfo.UNREACHABLE_BY_NULLANALYSIS);
+	return flowInfo;
+}
+
 public boolean checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo) {
 	// message send as a receiver
 	if ((nullStatus(flowInfo, flowContext) & FlowInfo.POTENTIALLY_NULL) != 0) // note that flowInfo is not used inside nullStatus(..)
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java
index 89554a1..c0a7712 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java
@@ -20,6 +20,8 @@
  *								bug 368546 - [compiler][resource] Avoid remaining false positives found when compiling the Eclipse SDK
  *								bug 382353 - [1.8][compiler] Implementation property modifiers should be accepted on default methods.
  *								bug 383368 - [compiler][null] syntactic null analysis for field references
+ *     Jesper S Moller <jesper@selskabet.org> - Contributions for
+ *								bug 378674 - "The method can be declared as static" is wrong
  *******************************************************************************/
 package org.eclipse.jdt.internal.compiler.ast;
 
@@ -36,7 +38,6 @@
 import org.eclipse.jdt.internal.compiler.flow.FlowContext;
 import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
 import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
-import org.eclipse.jdt.internal.compiler.lookup.Binding;
 import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
 import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
 import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
@@ -89,6 +90,7 @@
 	 */
 	public MethodDeclaration(CompilationResult compilationResult) {
 		super(compilationResult);
+		this.bits |= ASTNode.CanBeStatic; // Start with this assumption, will course correct during resolve and analyseCode.
 	}
 
 	public void analyseCode(ClassScope classScope, FlowContext flowContext, FlowInfo flowInfo) {
@@ -155,18 +157,6 @@
 			// nullity and mark as assigned
 			analyseArguments(flowInfo, this.arguments, this.binding);
 
-			if (this.arguments != null) {
-				for (int i = 0, count = this.arguments.length; i < count; i++) {
-					this.bits |= (this.arguments[i].bits & ASTNode.HasTypeAnnotations);
-					// if this method uses a type parameter declared by the declaring class,
-					// it can't be static. https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
-					if (this.arguments[i].binding != null && (this.arguments[i].binding.type instanceof TypeVariableBinding)) {
-						Binding declaringElement = ((TypeVariableBinding)this.arguments[i].binding.type).declaringElement;
-						if (this.binding != null && this.binding.declaringClass == declaringElement)
-							this.bits &= ~ASTNode.CanBeStatic;
-					}
-				}
-			}
 			if (this.binding.declaringClass instanceof MemberTypeBinding && !this.binding.declaringClass.isStatic()) {
 				// method of a non-static member type can't be static.
 				this.bits &= ~ASTNode.CanBeStatic;
@@ -377,12 +367,12 @@
 						if ((this.modifiers & ClassFileConstants.AccAbstract) == 0)
 							this.scope.problemReporter().methodNeedBody(this);
 				} else {
-					// the method HAS a body --> abstract native modifiers are forbiden
+					// the method HAS a body --> abstract native modifiers are forbidden
 					if (((this.modifiers & ClassFileConstants.AccNative) != 0) || ((this.modifiers & ClassFileConstants.AccAbstract) != 0))
 						this.scope.problemReporter().methodNeedingNoBody(this);
-					else if (this.binding != null && !this.binding.isStatic() && !(this.binding.declaringClass instanceof LocalTypeBinding) && !returnsUndeclTypeVar) {
-						// Not a method of local type - can be static
-						this.bits |= ASTNode.CanBeStatic;
+					else if (this.binding == null || this.binding.isStatic() || (this.binding.declaringClass instanceof LocalTypeBinding) || returnsUndeclTypeVar) {
+						// Cannot be static for one of the reasons stated above
+						this.bits &= ~ASTNode.CanBeStatic;
 					}
 				}
 				break;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java
index c908ee6..dad635b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java
@@ -28,6 +28,7 @@
  *								bug 394768 - [compiler][resource] Incorrect resource leak warning when creating stream in conditional
  *								bug 383368 - [compiler][null] syntactic null analysis for field references
  *								bug 401030 - [1.8][null] Null analysis support for lambda methods. 
+ *								bug 400761 - [compiler][null] null may be return as boolean without a diagnostic
  *     Jesper S Moller - Contributions for
  *							bug 382701 - [1.8][compiler] Implement semantic analysis of Lambda expressions & Reference expression
  *******************************************************************************/
@@ -71,9 +72,7 @@
 	MethodScope methodScope = currentScope.methodScope();
 	if (this.expression != null) {
 		flowInfo = this.expression.analyseCode(currentScope, flowContext, flowInfo);
-		if ((this.expression.implicitConversion & TypeIds.UNBOXING) != 0) {
-			this.expression.checkNPE(currentScope, flowContext, flowInfo);
-		}
+		this.expression.checkNPEbyUnboxing(currentScope, flowContext, flowInfo);
 		if (flowInfo.reachMode() == FlowInfo.REACHABLE)
 			checkAgainstNullAnnotation(currentScope, flowContext, this.expression.nullStatus(flowInfo, flowContext));
 		if (currentScope.compilerOptions().analyseResourceLeaks) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SuperReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SuperReference.java
index 5444d2a..6dafc92 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SuperReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SuperReference.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -7,12 +7,12 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Jesper S Moller - Contributions for
+ *								Bug 378674 - "The method can be declared as static" is wrong
  *******************************************************************************/
 package org.eclipse.jdt.internal.compiler.ast;
 
 import org.eclipse.jdt.internal.compiler.ASTVisitor;
-import org.eclipse.jdt.internal.compiler.flow.FlowContext;
-import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
 import org.eclipse.jdt.internal.compiler.impl.Constant;
 import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
 import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
@@ -68,9 +68,4 @@
 		visitor.visit(this, blockScope);
 		visitor.endVisit(this, blockScope);
 	}
-	
-	public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, boolean valueRequired) {
-		currentScope.resetEnclosingMethodStaticFlag();
-		return analyseCode(currentScope, flowContext, flowInfo);
-	}
 }
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ThisReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ThisReference.java
index 49de9a0..849fcc7 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ThisReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ThisReference.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -12,6 +12,8 @@
  *     Stephan Herrmann - Contribution for
  *								bug 331649 - [compiler][null] consider null annotations for fields
  *								bug 383368 - [compiler][null] syntactic null analysis for field references
+ *     Jesper S Moller - Contributions for
+ *								Bug 378674 - "The method can be declared as static" is wrong
  *******************************************************************************/
 package org.eclipse.jdt.internal.compiler.ast;
 
@@ -64,6 +66,7 @@
 			methodScope.problemReporter().errorThisSuperInStatic(this);
 			return false;
 		}
+		methodScope.resetEnclosingMethodStaticFlag();
 		return true;
 	}
 
@@ -152,13 +155,4 @@
 		visitor.visit(this, blockScope);
 		visitor.endVisit(this, blockScope);
 	}
-
-	public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
-		if (!isImplicitThis()) {
-			// explicit this reference, not allowed in static context
-			// https://bugs.eclipse.org/bugs/show_bug.cgi?id=335780
-			currentScope.resetEnclosingMethodStaticFlag();
-		}
-		return super.analyseCode(currentScope, flowContext, flowInfo);
-	}
 }
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java
index d978ac7..9a0cba7 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -17,6 +17,8 @@
  *								bug 358903 - Filter practically unimportant resource leak warnings
  *								bug 345305 - [compiler][null] Compiler misidentifies a case of "variable can only be null"
  *								bug 388996 - [compiler][resource] Incorrect 'potential resource leak'
+ *								bug 401088 - [compiler][null] Wrong warning "Redundant null check" inside nested try statement
+ *								bug 401092 - [compiler][null] Wrong warning "Redundant null check" in outer catch of nested try
  *******************************************************************************/
 package org.eclipse.jdt.internal.compiler.ast;
 
@@ -122,6 +124,11 @@
 
 	if (this.subRoutineStartLabel == null) {
 		// no finally block -- this is a simplified copy of the else part
+		if (flowContext instanceof FinallyFlowContext) {
+			// if this TryStatement sits inside another TryStatement,
+			// report into the initsOnFinally of the outer try-block.
+			flowContext.initsOnFinally = ((FinallyFlowContext)flowContext).tryContext.initsOnFinally;
+		}
 		// process the try block in a context handling the local exceptions.
 		ExceptionHandlingFlowContext handlingContext =
 //{ObjectTeams: make hookable:
@@ -257,7 +264,7 @@
 
 		// chain up null info registry
 		if (flowContext.initsOnFinally != null) {
-			flowContext.initsOnFinally.addNullInfoFrom(handlingContext.initsOnFinally);
+			flowContext.mergeFinallyNullInfo(handlingContext.initsOnFinally);
 		}
 
 		return tryInfo;
@@ -267,6 +274,11 @@
 		UnconditionalFlowInfo subInfo;
 		// analyse finally block first
 		insideSubContext = new InsideSubRoutineFlowContext(flowContext, this);
+		if (flowContext instanceof FinallyFlowContext) {
+			// if this TryStatement sits inside another TryStatement,
+			// let the nested context report into the initsOnFinally of the outer try-block.
+			insideSubContext.initsOnFinally = ((FinallyFlowContext)flowContext).tryContext.initsOnFinally;
+		}
 
 		// process the try block in a context handling the local exceptions.
 		// (advance instantiation so we can wire this into the FinallyFlowContext)
@@ -431,7 +443,7 @@
 
 		// chain up null info registry
 		if (flowContext.initsOnFinally != null) {
-			flowContext.initsOnFinally.addNullInfoFrom(handlingContext.initsOnFinally);
+			flowContext.mergeFinallyNullInfo(handlingContext.initsOnFinally);
 		}
 
 		this.naturalExitMergeInitStateIndex =
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/MethodInfoWithParameterAnnotations.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/MethodInfoWithParameterAnnotations.java
index 8f31b3e..407e5a6 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/MethodInfoWithParameterAnnotations.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/MethodInfoWithParameterAnnotations.java
@@ -13,27 +13,14 @@
 package org.eclipse.jdt.internal.compiler.classfmt;
 
 import org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation;
-import org.eclipse.jdt.internal.compiler.util.Util;
 
 class MethodInfoWithParameterAnnotations extends MethodInfoWithAnnotations {
 	private AnnotationInfo[][] parameterAnnotations;
 
 MethodInfoWithParameterAnnotations(MethodInfo methodInfo, AnnotationInfo[] annotations, AnnotationInfo[][] parameterAnnotations) {
 	super(methodInfo, annotations);
-	if (methodInfo.isConstructor()) {
-		int parametersCount = Util.getParameterCount(methodInfo.getMethodDescriptor());
-		if (parameterAnnotations.length < parametersCount) {
-			AnnotationInfo[][] temp = new AnnotationInfo[parametersCount][];
-			System.arraycopy(parameterAnnotations, 0, temp, 1, parameterAnnotations.length);
-			this.parameterAnnotations = temp;
-		} else {
-			this.parameterAnnotations = parameterAnnotations;
-		}
-	} else {
-		this.parameterAnnotations = parameterAnnotations;
-	}
+	this.parameterAnnotations = parameterAnnotations;
 }
-
 public IBinaryAnnotation[] getParameterAnnotations(int index) {
 	return this.parameterAnnotations[index];
 }
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java
index ba342e3..56e25ae 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java
@@ -84,6 +84,8 @@
 
 	public static final int DEFER_NULL_DIAGNOSTIC = 0x1;
 	public static final int PREEMPT_NULL_DIAGNOSTIC = 0x2;
+	// inside an assertFalse checks for equality / inequality have reversed meaning for syntactic analysis for fields:
+	public static final int INSIDE_NEGATIVE_ASSERT = 0x4;
 	/**
 	 * used to hide null comparison related warnings inside assert statements 
 	 */
@@ -154,6 +156,13 @@
 		this.nullCheckedFieldReferences[len] = reference;
 	}
 }
+
+/** If a null checked field has been recorded recently, increase its time to live. */
+public void extendTimeToLiveForNullCheckedField(int t) {
+	if (this.timeToLiveForNullCheckInfo > 0)
+		this.timeToLiveForNullCheckInfo += t;
+}
+
 /**
  * Forget any information about fields that were previously known to be non-null.
  * 
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
index 2edd752..3d9d3a3 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
@@ -50,6 +50,7 @@
 import org.eclipse.objectteams.otdt.internal.core.compiler.lookup.ITeamAnchor;
 import org.eclipse.objectteams.otdt.internal.core.compiler.lookup.RoleTypeBinding;
 import org.eclipse.objectteams.otdt.internal.core.compiler.model.TeamModel;
+import org.eclipse.objectteams.otdt.internal.core.compiler.statemachine.transformer.RoleSplitter;
 import org.eclipse.objectteams.otdt.internal.core.compiler.statemachine.transformer.TeamMethodGenerator;
 import org.eclipse.objectteams.otdt.internal.core.compiler.util.AstEdit;
 import org.eclipse.objectteams.otdt.internal.core.compiler.util.RoleFileHelper;
@@ -149,6 +150,9 @@
 	final static int BUILD_TYPE_HIERARCHY = 1;
 	final static int CHECK_AND_SET_IMPORTS = 2;
 	final static int CONNECT_TYPE_HIERARCHY = 3;
+//{ObjectTeams: include this step into LookupEnvironment's control:
+	final static int ROLES_LINKED = 5;
+// SH}
 
 	static final ProblemPackageBinding TheNotFoundPackage = new ProblemPackageBinding(CharOperation.NO_CHAR, NotFound);
 	static final ProblemReferenceBinding TheNotFoundType = new ProblemReferenceBinding(CharOperation.NO_CHAR_CHAR, null, NotFound);
@@ -335,10 +339,26 @@
 		done = true;
 	  }
 	  StateHelper.setStateRecursive(this.units[i], ITranslationStates.STATE_LENV_DONE_FIELDS_AND_METHODS, done);
-// SH}
+/* orig: defer to next loop:
 		this.units[i] = null; // release unnecessary reference to the parsed unit
+  :giro */
+// SH}
 	}
 	this.stepCompleted = BUILD_FIELDS_AND_METHODS;
+
+//{ObjectTeams: one more step to handle here:
+	for (int i = this.lastCompletedUnitIndex + 1; i <= this.lastUnitIndex; i++) {
+		boolean done = false;
+		if (this.units[i].state.getState() < ITranslationStates.STATE_ROLES_LINKED) {
+			RoleSplitter.linkRoles(this.units[i]);
+			done = true;
+		}
+		StateHelper.setStateRecursive(this.units[i], ITranslationStates.STATE_ROLES_LINKED, done);
+		this.units[i] = null; // release unnecessary reference to the parsed unit
+	}
+	this.stepCompleted = ROLES_LINKED;
+// SH}
+
 	this.lastCompletedUnitIndex = this.lastUnitIndex;
 	this.unitBeingCompleted = null;
 }
@@ -366,7 +386,12 @@
 		return 0; // avoid re-entrance
 	int todo = this.stepCompleted;
 //SH}
+//{ObjectTeams: different last step:
+/* orig:
 	if (this.stepCompleted == BUILD_FIELDS_AND_METHODS) {
+  :giro */
+	if (this.stepCompleted == ROLES_LINKED) {
+// SH}
 		// This can only happen because the original set of units are completely built and
 		// are now being processed, so we want to treat all the additional units as a group
 		// until they too are completely processed.
@@ -403,6 +428,10 @@
 // SH}
 			(this.unitBeingCompleted = parsedUnit).scope.connectTypeHierarchy();
 
+//{ObjectTeams: one more step:
+		if (todo >= ROLES_LINKED)
+			RoleSplitter.linkRoles(this.unitBeingCompleted = parsedUnit);
+
 		this.unitBeingCompleted = null;
 	}
 //{ObjectTeams: report actual step achieved:
@@ -1908,6 +1937,8 @@
 		return ITranslationStates.STATE_LENV_CONNECT_TYPE_HIERARCHY;
 	case BUILD_FIELDS_AND_METHODS:
 		return ITranslationStates.STATE_LENV_DONE_FIELDS_AND_METHODS;
+	case ROLES_LINKED:
+		return ITranslationStates.STATE_ROLES_LINKED;
 	}
 	return ITranslationStates.STATE_NONE;
 }
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
index 72d8a50..803c97a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
@@ -22,6 +22,8 @@
  *								bug 388281 - [compiler][null] inheritance of null annotations as an option
  *								bug 395002 - Self bound generic class doesn't resolve bounds properly for wildcards for certain parametrisation.
  *								bug 392862 - [1.8][compiler][null] Evaluate null annotations on array types
+ *								bug 400421 - [compiler] Null analysis for fields does not take @com.google.inject.Inject into account
+ *								bug 382069 - [null] Make the null analysis consider JUnit's assertNotNull similarly to assertions
  *      Jesper S Moller - Contributions for
  *								bug 382701 - [1.8][compiler] Implement semantic analysis of Lambda expressions & Reference expression
  *******************************************************************************/
@@ -565,10 +567,34 @@
 				return;
 			}
 // SH}
-			if (!CharOperation.equals(TypeConstants.JAVA, this.compoundName[0]))
+			char[] packageName = this.compoundName[0];
+			// expect only java.*.* and javax.*.* and junit.*.* and org.junit.*
+			switch (packageName.length) {
+				case 3: // only one type in this group, yet:
+					if (CharOperation.equals(TypeConstants.ORG_JUNIT_ASSERT, this.compoundName))
+						this.id = TypeIds.T_OrgJunitAssert;
+					return;						
+				case 4:
+					if (!CharOperation.equals(TypeConstants.JAVA, packageName))
+						return;
+					break; // continue below ...
+				case 5:
+					switch (packageName[1]) {
+						case 'a':
+							if (CharOperation.equals(TypeConstants.JAVAX_ANNOTATION_INJECT_INJECT, this.compoundName))
+								this.id = TypeIds.T_JavaxInjectInject;
+							return;
+						case 'u':
+							if (CharOperation.equals(TypeConstants.JUNIT_FRAMEWORK_ASSERT, this.compoundName))
+								this.id = TypeIds.T_JunitFrameworkAssert;
+							return;
+					}
 				return;
+				default: return;
+			}
+			// ... at this point we know it's java.*.*
 			
-			char[] packageName = this.compoundName[1];
+			packageName = this.compoundName[1];
 			if (packageName.length == 0) return; // just to be safe
 			char[] typeName = this.compoundName[2];
 			if (typeName.length == 0) return; // just to be safe
@@ -616,6 +642,10 @@
 									if (CharOperation.equals(typeName, TypeConstants.JAVA_UTIL_ITERATOR[2]))
 										this.id = TypeIds.T_JavaUtilIterator;
 									return;
+								case 'O' :
+									if (CharOperation.equals(typeName, TypeConstants.JAVA_UTIL_OBJECTS[2]))
+										this.id = TypeIds.T_JavaUtilObjects;
+									return;
 							}
 						}
 						return;
@@ -785,6 +815,12 @@
 		break;
 
 		case 4:
+			// expect one type from com.*.*.*:
+			if (CharOperation.equals(TypeConstants.COM_GOOGLE_INJECT_INJECT, this.compoundName)) {
+				this.id = TypeIds.T_ComGoogleInjectInject;
+				return;
+			}
+			// otherwise only expect java.*.*.*
 			if (!CharOperation.equals(TypeConstants.JAVA, this.compoundName[0]))
 				return;
 			packageName = this.compoundName[1];
@@ -902,6 +938,8 @@
 					packageName = this.compoundName[1];
 					if (packageName.length == 0) return; // just to be safe
 
+					switch (packageName[0]) {
+						case 'e':
 					if (CharOperation.equals(TypeConstants.ECLIPSE, packageName)) {
 						packageName = this.compoundName[2];
 						if (packageName.length == 0) return; // just to be safe
@@ -925,6 +963,24 @@
 						return;
 					}
 					return;
+						case 'a':
+							if (CharOperation.equals(TypeConstants.APACHE, packageName)) {
+								if (CharOperation.equals(TypeConstants.COMMONS, this.compoundName[2])) {
+									if (CharOperation.equals(TypeConstants.ORG_APACHE_COMMONS_LANG_VALIDATE, this.compoundName))
+										this.id = TypeIds.T_OrgApacheCommonsLangValidate;
+									else if (CharOperation.equals(TypeConstants.ORG_APACHE_COMMONS_LANG3_VALIDATE, this.compoundName))
+										this.id = TypeIds.T_OrgApacheCommonsLang3Validate;
+			}
+							}
+							return;
+					}
+					return;
+				case 'c':
+					if (!CharOperation.equals(TypeConstants.COM, this.compoundName[0]))
+						return;
+					if (CharOperation.equals(TypeConstants.COM_GOOGLE_COMMON_BASE_PRECONDITIONS, this.compoundName))
+						this.id = TypeIds.T_ComGoogleCommonBasePreconditions;
+					return;
 			}
 			break;
 	}
@@ -1913,7 +1969,7 @@
 	}
 	return shortReadableName;
 }
-// SH} // end sourceName - editid section
+// SH} // end sourceName - edited section
 
 //{ObjectTeams: to be overridden in RoleTypeBinding
 public char[] optimalName() {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java
index 4db9c7c..5569306 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java
@@ -17,8 +17,11 @@
  *	 							bug 186342 - [compiler][null] Using annotations for null checking
  *								bug 387612 - Unreachable catch block...exception is never thrown from the try
  *								bug 395002 - Self bound generic class doesn't resolve bounds properly for wildcards for certain parametrisation.
+ *								bug 401456 - Code compiles from javac/intellij, but fails from eclipse
+ *								bug 401271 - StackOverflowError when searching for a methods references
  *     Jesper S Moller - Contributions for
  *								bug 382721 - [1.8][compiler] Effectively final variables needs special treatment
+ *								Bug 378674 - "The method can be declared as static" is wrong
  *******************************************************************************/
 package org.eclipse.jdt.internal.compiler.lookup;
 
@@ -421,13 +424,12 @@
 	/**
 	 * Returns a type, where original type was substituted using the receiver
 	 * parameterized type.
-	 * In raw mode, all parameterized type denoting same original type are converted
-	 * to raw types. e.g.
-	 * class X <T> {
-	 *   X<T> foo;
-	 *   X<String> bar;
-	 * } when used in raw fashion, then type of both foo and bar is raw type X.
-	 *
+	 * In raw mode (see {@link Substitution#isRawSubstitution()}),
+	 * all parameterized types are converted to raw types.
+	 * Cf. 4.8: "The type of a constructor (8.8), instance method (8.4, 9.4),
+	 *  or non-static field (8.3) M of a raw type C that is not inherited from its 
+	 *  superclasses or superinterfaces is the raw type that corresponds to the erasure
+	 *  of its type in the generic declaration corresponding to C." 
 	 */
 	public static TypeBinding substitute(Substitution substitution, TypeBinding originalType) {
 		if (originalType == null) return null;
@@ -446,6 +448,9 @@
 				ReferenceBinding substitutedEnclosing = originalEnclosing;
 				if (originalEnclosing != null) {
 					substitutedEnclosing = (ReferenceBinding) substitute(substitution, originalEnclosing);
+					if (isMemberTypeOfRaw(originalType, substitutedEnclosing))
+						return originalParameterizedType.environment.createRawType(
+								originalParameterizedType.genericType(), substitutedEnclosing);
 				}
 				TypeBinding[] originalArguments = originalParameterizedType.arguments;
 				TypeBinding[] substitutedArguments = originalArguments;
@@ -516,6 +521,8 @@
 				substitutedEnclosing = originalEnclosing;
 				if (originalEnclosing != null) {
 					substitutedEnclosing = (ReferenceBinding) substitute(substitution, originalEnclosing);
+					if (isMemberTypeOfRaw(originalType, substitutedEnclosing))
+						return substitution.environment().createRawType(originalReferenceType, substitutedEnclosing);
 				}
 
 			    // treat as if parameterized with its type variables (non generic type gets 'null' arguments)
@@ -531,6 +538,8 @@
 				substitutedEnclosing = originalEnclosing;
 				if (originalEnclosing != null) {
 					substitutedEnclosing = (ReferenceBinding) substitute(substitution, originalEnclosing);
+					if (isMemberTypeOfRaw(originalType, substitutedEnclosing))
+						return substitution.environment().createRawType(originalReferenceType, substitutedEnclosing);
 				}
 
 				if (substitution.isRawSubstitution()) {
@@ -544,6 +553,19 @@
 		return originalType;
 	}
 
+	private static boolean isMemberTypeOfRaw(TypeBinding originalType, ReferenceBinding substitutedEnclosing) {
+		// 4.8:
+		// "a raw type is defined to be one of:
+		// ...
+	    // * A non-static member type of a raw type R that is not 
+		//   inherited from a superclass or superinterface of R."
+
+		// Due to staticness, e.g., Map.Entry<String,Object> is *not* considered as a raw type
+
+		return (substitutedEnclosing != null && substitutedEnclosing.isRawType()) 
+				&& ((originalType instanceof ReferenceBinding) && !((ReferenceBinding)originalType).isStatic());
+	}
+
 	/**
 	 * Returns an array of types, where original types got substituted given a substitution.
 	 * Only allocate an array if anything is different.
@@ -1911,6 +1933,7 @@
 				ProblemFieldBinding foundInsideProblem = null;
 				// inside Constructor call or inside static context
 				Scope scope = this;
+				MethodScope methodScope = null;
 				int depth = 0;
 				int foundDepth = 0;
 				boolean shouldTrackOuterLocals = false;
@@ -1918,7 +1941,7 @@
 				done : while (true) { // done when a COMPILATION_UNIT_SCOPE is found
 					switch (scope.kind) {
 						case METHOD_SCOPE :
-							MethodScope methodScope = (MethodScope) scope;
+							methodScope = (MethodScope) scope;
 							insideStaticContext |= methodScope.isStatic;
 							insideConstructorCall |= methodScope.isConstructorCall;
 							insideTypeAnnotation = methodScope.insideTypeAnnotation;
@@ -1992,6 +2015,8 @@
 														fieldBinding.declaringClass,
 														name,
 														ProblemReasons.NonStaticReferenceInStaticContext);
+											} else if (methodScope != null) {
+												methodScope.resetEnclosingMethodStaticFlag();
 											}
 										}
 										if (receiverType == fieldBinding.declaringClass || compilerOptions().complianceLevel >= ClassFileConstants.JDK1_4) {
@@ -2342,6 +2367,7 @@
 		MethodBinding foundProblem = null;
 		boolean foundProblemVisible = false;
 		Scope scope = this;
+		MethodScope methodScope = null;
 		int depth = 0;
 		// in 1.4 mode (inherited visible shadows enclosing)
 		CompilerOptions options;
@@ -2350,7 +2376,7 @@
 		done : while (true) { // done when a COMPILATION_UNIT_SCOPE is found
 			switch (scope.kind) {
 				case METHOD_SCOPE :
-					MethodScope methodScope = (MethodScope) scope;
+					methodScope = (MethodScope) scope;
 					insideStaticContext |= methodScope.isStatic;
 					insideConstructorCall |= methodScope.isConstructorCall;
 					insideTypeAnnotation = methodScope.insideTypeAnnotation;
@@ -2389,6 +2415,8 @@
 											insideConstructorCall
 												? ProblemReasons.NonStaticReferenceInConstructorInvocation
 												: ProblemReasons.NonStaticReferenceInStaticContext);
+									} else if (!methodBinding.isStatic() && methodScope != null) {
+										methodScope.resetDeclaringClassMethodStaticFlag(receiverType);
 									}
 									if (inheritedHasPrecedence
 											|| receiverType == methodBinding.declaringClass
@@ -3000,6 +3028,7 @@
     private final Binding internalGetTypeOrPackage(char[] name, int mask, boolean needResolve) {
 // SH}
 		Scope scope = this;
+		MethodScope methodScope = null;
 		ReferenceBinding foundType = null;
 		boolean insideStaticContext = false;
 		boolean insideTypeAnnotation = false;
@@ -3016,7 +3045,7 @@
 			done : while (true) { // done when a COMPILATION_UNIT_SCOPE is found
 				switch (scope.kind) {
 					case METHOD_SCOPE :
-						MethodScope methodScope = (MethodScope) scope;
+						methodScope = (MethodScope) scope;
 						AbstractMethodDeclaration methodDecl = methodScope.referenceMethod();
 						if (methodDecl != null) {
 							if (methodDecl.binding != null) {
@@ -3104,6 +3133,8 @@
 						if (typeVariable != null) {
 							if (insideStaticContext) // do not consider this type modifiers: access is legite within same type
 								return new ProblemReferenceBinding(new char[][]{name}, typeVariable, ProblemReasons.NonStaticReferenceInStaticContext);
+							else if (methodScope != null)
+								methodScope.resetEnclosingMethodStaticFlag();
 							return typeVariable;
 						}
 						insideStaticContext |= sourceType.isStatic();
@@ -3170,53 +3201,11 @@
 					}
 				}
 			}
-			// walk single static imports. A type found here will shadow types with same name in other CU's, or types coming
-			// from on-demand imports. JLS 7.5.3
+			// In this location we had a fix for 
 			// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318401
-			if (imports != null) {
-				ReferenceBinding type = null;
-				nextImport : for (int i = 0, length = imports.length; i < length; i++) {
-					ImportBinding importBinding = imports[i];
-					if (importBinding.isStatic()) {
-						ReferenceBinding temp = null;
-						if (CharOperation.equals(importBinding.compoundName[importBinding.compoundName.length - 1], name)) {
-							Binding resolvedImport = importBinding.resolvedImport;
-							if (resolvedImport == null) continue nextImport;
-							if (resolvedImport instanceof MethodBinding || resolvedImport instanceof FieldBinding) {
-								// check to see if there are also member types with the same name
-								// must find the importRef's type again since the method/field can be from an inherited type
-								// see StaticImportTest#test084 for more clarity
-								char[][] importName = importBinding.reference.tokens;
-								TypeBinding referencedType = getType(importName, importName.length - 1);
-								if (referencedType != null && referencedType instanceof ReferenceBinding) {
-									temp = findMemberType(name, (ReferenceBinding) referencedType);
-								}
-							}
-							if (temp != null && temp.isStatic() && temp != type) {
-								if (temp.isValidBinding()) {
-									if (!temp.canBeSeenBy(unitScope.fPackage)) {
-										// Answer error binding - type is not visible
-										foundType = new ProblemReferenceBinding(new char[][]{name}, type, ProblemReasons.NotVisible);
-									} else {
-										ImportReference importReference = importBinding.reference;
-										if (importReference != null) {
-											importReference.bits |= ASTNode.Used;
-										}
-										type = temp;
-									}
-								} else if (foundType == null) {
-									foundType = temp;
-								}
-							}
-						}
-					}
-				}
-				if (type != null) {
-					if (typeOrPackageCache != null)
-						typeOrPackageCache.put(name, type);
-					return type;
-				}
-			}
+			// However, as of today (4.3M6 candidate) this fix seems unnecessary, while causing StackOverflowError in
+			// https://bugs.eclipse.org/bugs/show_bug.cgi?id=401271
+
 			// check if the name is in the current package, skip it if its a sub-package
 			PackageBinding currentPackage = unitScope.fPackage;
 			unitScope.recordReference(currentPackage.compoundName, name);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
index 7fd2842..e54bce7 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
@@ -2248,6 +2248,9 @@
             		this.scope.problemReporter().invalidType(arg.type, problemBinding);
             	}
             }
+            // fix for NPE of https://bugs.eclipse.org/403396
+            if (parameterType != null && !parameterType.isValidBinding() && ((parameterType.tagBits & TagBits.HasMissingType) == 0))
+            	foundArgProblem = true;
 // SH}
 			if (parameterType == null) {
 				foundArgProblem = true;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java
index 8bc923a..8b94eee 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java
@@ -15,6 +15,8 @@
  *								bug 349326 - [1.7] new warning for missing try-with-resources
  *								bug 358903 - Filter practically unimportant resource leak warnings
  *								bug 381445 - [compiler][resource] Can the resource leak check be made aware of Closeables.closeQuietly?
+ *								bug 400421 - [compiler] Null analysis for fields does not take @com.google.inject.Inject into account
+ *								bug 382069 - [null] Make the null analysis consider JUnit's assertNotNull similarly to assertions
  *******************************************************************************/
 package org.eclipse.jdt.internal.compiler.lookup;
 
@@ -91,6 +93,17 @@
 	char[] TYPE_USE_TARGET  = "TYPE_USE".toCharArray(); //$NON-NLS-1$
 	char[] TYPE_PARAMETER_TARGET = "TYPE_PARAMETER".toCharArray(); //$NON-NLS-1$
 
+    // common 3rd party package components:
+    char[] ORG = "org".toCharArray(); //$NON-NLS-1$
+    char[] ECLIPSE = "eclipse".toCharArray(); //$NON-NLS-1$
+    char[] CORE = "core".toCharArray(); //$NON-NLS-1$
+    char[] RUNTIME = "runtime".toCharArray(); //$NON-NLS-1$
+    char[] APACHE = "apache".toCharArray(); //$NON-NLS-1$
+    char[] COMMONS = "commons".toCharArray(); //$NON-NLS-1$
+    char[] LANG3 = "lang3".toCharArray(); //$NON-NLS-1$
+    char[] COM = "com".toCharArray(); //$NON-NLS-1$
+    char[] GOOGLE = "google".toCharArray(); //$NON-NLS-1$
+
 	// Constant compound names
 	char[][] JAVA_LANG = {JAVA, LANG};
 	char[][] JAVA_IO = {JAVA, IO};
@@ -126,6 +139,7 @@
 	char[][] JAVA_LANG_VOID = {JAVA, LANG, "Void".toCharArray()}; //$NON-NLS-1$
 	char[][] JAVA_UTIL_COLLECTION = {JAVA, UTIL, "Collection".toCharArray()}; //$NON-NLS-1$
 	char[][] JAVA_UTIL_ITERATOR = {JAVA, UTIL, "Iterator".toCharArray()}; //$NON-NLS-1$
+	char[][] JAVA_UTIL_OBJECTS = {JAVA, UTIL, "Objects".toCharArray()}; //$NON-NLS-1$
 	char[][] JAVA_LANG_DEPRECATED = {JAVA, LANG, "Deprecated".toCharArray()}; //$NON-NLS-1$
 	char[][] JAVA_LANG_ANNOTATION_DOCUMENTED = {JAVA, LANG, ANNOTATION, "Documented".toCharArray()}; //$NON-NLS-1$
 	char[][] JAVA_LANG_ANNOTATION_INHERITED = {JAVA, LANG, ANNOTATION, "Inherited".toCharArray()}; //$NON-NLS-1$
@@ -177,12 +191,13 @@
 			this.selector = selector;
 		}
 	}
-	char[][] GUAVA_CLOSEABLES = { "com".toCharArray(), "google".toCharArray(), "common".toCharArray(), "io".toCharArray(), "Closeables".toCharArray() }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
-	char[][] APACHE_IOUTILS = { "org".toCharArray(), "apache".toCharArray(), "commons".toCharArray(), "io".toCharArray(), "IOUtils".toCharArray() }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+	char[][] GUAVA_CLOSEABLES = { COM, GOOGLE, "common".toCharArray(), IO, "Closeables".toCharArray() }; //$NON-NLS-1$ //$NON-NLS-2$
+	char[][] APACHE_IOUTILS = { ORG, APACHE, COMMONS, IO, "IOUtils".toCharArray() }; //$NON-NLS-1$
+	char[] CLOSE_QUIETLY = "closeQuietly".toCharArray(); //$NON-NLS-1$
 	CloseMethodRecord[] closeMethods = new CloseMethodRecord[] {
-		new CloseMethodRecord(GUAVA_CLOSEABLES, "closeQuietly".toCharArray()), //$NON-NLS-1$
-		new CloseMethodRecord(GUAVA_CLOSEABLES, "close".toCharArray()), //$NON-NLS-1$
-		new CloseMethodRecord(APACHE_IOUTILS, "closeQuietly".toCharArray()) //$NON-NLS-1$
+		new CloseMethodRecord(GUAVA_CLOSEABLES, CLOSE_QUIETLY),
+		new CloseMethodRecord(GUAVA_CLOSEABLES, CLOSE),
+		new CloseMethodRecord(APACHE_IOUTILS, CLOSE_QUIETLY)
 	};
 	// white lists of closeables:
 	char[][] JAVA_IO_WRAPPER_CLOSEABLES = new char[][] {
@@ -238,11 +253,46 @@
 		"StringBufferInputStream".toCharArray(), //$NON-NLS-1$
 	};
 	
-	char[] ORG = "org".toCharArray(); //$NON-NLS-1$
-	char[] ECLIPSE = "eclipse".toCharArray(); //$NON-NLS-1$
-	char[] CORE = "core".toCharArray(); //$NON-NLS-1$
-	char[] RUNTIME = "runtime".toCharArray(); //$NON-NLS-1$
-	char[][] ORG_ECLIPSE_CORE_RUNTIME_ASSERT = new char[][] { ORG, ECLIPSE, CORE, RUNTIME, "Assert".toCharArray()}; //$NON-NLS-1$
+	// different assertion utilities:
+	char[] ASSERT_CLASS = "Assert".toCharArray(); //$NON-NLS-1$
+	char[][] ORG_ECLIPSE_CORE_RUNTIME_ASSERT = new char[][] { ORG, ECLIPSE, CORE, RUNTIME, ASSERT_CLASS };
+	// ... methods:
+	char[] IS_NOTNULL = "isNotNull".toCharArray(); //$NON-NLS-1$
+	
+	char[] JUNIT = "junit".toCharArray(); //$NON-NLS-1$
+	char[] FRAMEWORK = "framework".toCharArray(); //$NON-NLS-1$
+	char[][] JUNIT_FRAMEWORK_ASSERT = new char[][] { JUNIT, FRAMEWORK, ASSERT_CLASS };
+	char[][] ORG_JUNIT_ASSERT = new char[][] { ORG, JUNIT, ASSERT_CLASS };
+	// ... methods:
+	char[] ASSERT_NULL = "assertNull".toCharArray(); //$NON-NLS-1$
+	char[] ASSERT_NOTNULL = "assertNotNull".toCharArray(); //$NON-NLS-1$
+	char[] ASSERT_TRUE = "assertTrue".toCharArray(); //$NON-NLS-1$
+	char[] ASSERT_FALSE = "assertFalse".toCharArray(); //$NON-NLS-1$
+	
+	char[] VALIDATE_CLASS = "Validate".toCharArray(); //$NON-NLS-1$
+	char[][] ORG_APACHE_COMMONS_LANG_VALIDATE = new char[][] { ORG, APACHE, COMMONS, LANG, VALIDATE_CLASS };
+	char[][] ORG_APACHE_COMMONS_LANG3_VALIDATE = new char[][] { ORG, APACHE, COMMONS, LANG3, VALIDATE_CLASS };
+	// ... methods:
+	char[] IS_TRUE = "isTrue".toCharArray(); //$NON-NLS-1$
+	char[] NOT_NULL = "notNull".toCharArray(); //$NON-NLS-1$
+	
+	char[][] COM_GOOGLE_COMMON_BASE_PRECONDITIONS = new char[][] { 
+			COM, GOOGLE, "common".toCharArray(), "base".toCharArray(), "Preconditions".toCharArray() }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+	// ... methods:
+	char[] CHECK_NOT_NULL = "checkNotNull".toCharArray(); //$NON-NLS-1$
+	char[] CHECK_ARGUMENT = "checkArgument".toCharArray(); //$NON-NLS-1$
+	char[] CHECK_STATE = "checkState".toCharArray(); //$NON-NLS-1$
+
+	// ... methods in java.util.Objects:
+	char[] REQUIRE_NON_NULL = "requireNonNull".toCharArray(); //$NON-NLS-1$
+	
+	// different @Inject annotations are relevant for @NonNull fields
+	char[] INJECT_PACKAGE = "inject".toCharArray(); //$NON-NLS-1$
+	char[] INJECT_TYPE = "Inject".toCharArray(); //$NON-NLS-1$
+	char[][] JAVAX_ANNOTATION_INJECT_INJECT = new char[][] { JAVAX, INJECT_PACKAGE, INJECT_TYPE };
+	char[][] COM_GOOGLE_INJECT_INJECT = new char[][] {COM, GOOGLE, INJECT_PACKAGE, INJECT_TYPE };
+	//    detail for the above:
+	char[] OPTIONAL = "optional".toCharArray(); //$NON-NLS-1$
 
 	// Constraints for generic type argument inference
 	int CONSTRAINT_EQUAL = 0;		// Actual = Formal
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java
index 5dacf42..186cb9c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java
@@ -16,6 +16,8 @@
  *     							bug 359362 - FUP of bug 349326: Resource leak on non-Closeable resource
  *								bug 186342 - [compiler][null] Using annotations for null checking
  *								bug 358903 - Filter practically unimportant resource leak warnings
+ *								bug 400421 - [compiler] Null analysis for fields does not take @com.google.inject.Inject into account
+ *								bug 382069 - [null] Make the null analysis consider JUnit's assertNotNull similarly to assertions
  *******************************************************************************/
 package org.eclipse.jdt.internal.compiler.lookup;
 
@@ -113,6 +115,18 @@
 	
 	// new in 3.8 to identify org.eclipse.core.runtime.Assert
 	final int T_OrgEclipseCoreRuntimeAssert = 68;
+	// new in 3.9 to identify more assertion utilities:
+	final int T_JunitFrameworkAssert = 69;
+	final int T_OrgJunitAssert = 70;
+	final int T_OrgApacheCommonsLangValidate = 71;
+	final int T_OrgApacheCommonsLang3Validate = 72;
+	final int T_ComGoogleCommonBasePreconditions = 73;
+	final int T_JavaUtilObjects = 74;
+
+	// new in 3.9 to identify known @Inject annotations
+	final int T_JavaxInjectInject = 80;
+	final int T_ComGoogleInjectInject = 81;
+
 
 	// java 8
 	final int T_JavaLangFunctionalInterface = 69;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java
index 8eae081..326a7fd 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -1657,7 +1657,7 @@
 			if (peekChar() == '}') {
 				if (domParser) {
 					createTag();
-					pushText(textPosition, this.starPosition);
+					pushText(textPosition, this.index);
 				}
 				return true;
 			}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java
index 639cd9a..248f517 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -93,6 +93,7 @@
 		// Parse
 		try {
 			this.source = this.sourceParser.scanner.source;
+			this.scanner.setSource(this.source); // updating source in scanner
 			if (this.checkDocComment) {
 				// Initialization
 				this.scanner.lineEnds = this.sourceParser.scanner.lineEnds;
@@ -141,6 +142,7 @@
 			}
 		} finally {
 			this.source = null; // release source as soon as finished
+			this.scanner.setSource((char[]) null); //release source in scanner
 		}
 		return this.deprecated;
 	}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
index decfe9f..5c6eac4 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
@@ -25,6 +25,7 @@
  *							bug 382701 - [1.8][compiler] Implement semantic analysis of Lambda expressions & Reference expression
  *							bug 399695 - [1.8][compiler] [1.8][compiler] migrate parser to other syntax for default methods
  *							bug 384567 - [1.5][compiler] Compiler accepts illegal modifiers on package declaration
+ *									bug 393192 - Incomplete type hierarchy with > 10 annotations
  *******************************************************************************/
 package org.eclipse.jdt.internal.compiler.parser;
 
@@ -13641,6 +13642,7 @@
 	this.dietInt = oldDietInt;
   }
 //SH}
+	this.problemReporter.referenceContext = null; // Null this so we won't escalate problems needlessly (bug 393192)
 	if (DEBUG) System.out.println("-- EXIT FROM PARSE METHOD --");  //$NON-NLS-1$
 }
 public void parse(ConstructorDeclaration cd, CompilationUnitDeclaration unit, boolean recordLineSeparator) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
index 5785001..d39d54e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
@@ -37,6 +37,8 @@
  *								bug 402028 - [1.8][compiler] null analysis for reference expressions 
  *								bug 401796 - [1.8][compiler] don't treat default methods as overriding an independent inherited abstract method
  *								bug 404649 - [1.8][compiler] detect illegal reference to indirect or redundant super
+ *								bug 376590 - Private fields with @Inject are ignored by unused field validation
+ *								bug 400761 - [compiler][null] null may be return as boolean without a diagnostic
  *      Jesper S Moller <jesper@selskabet.org> -  Contributions for
  *								bug 382701 - [1.8][compiler] Implement semantic analysis of Lambda expressions & Reference expression
  *								bug 382721 - [1.8][compiler] Effectively final variables needs special treatment
@@ -384,12 +386,16 @@
 
 		case IProblem.NullLocalVariableReference:
 		case IProblem.NullableFieldReference:
+		case IProblem.NullExpressionReference:
+		case IProblem.NullUnboxing:
 			return CompilerOptions.NullReference;
 
 		case IProblem.PotentialNullLocalVariableReference:
 		case IProblem.PotentialNullMessageSendReference:
 		case IProblem.ArrayReferencePotentialNullReference:
 		case IProblem.DereferencingNullableExpression:
+		case IProblem.PotentialNullExpressionReference:
+		case IProblem.PotentialNullUnboxing:
 			return CompilerOptions.PotentialNullReference;
 
 		case IProblem.RedundantLocalVariableNullAssignment:
@@ -6158,6 +6164,10 @@
 }
 
 public void localVariableNullReference(LocalVariableBinding local, ASTNode location) {
+	if (location instanceof Expression && (((Expression)location).implicitConversion & TypeIds.UNBOXING) != 0) {
+		nullUnboxing(location, local.type);
+		return;
+	}
 	int severity = computeSeverity(IProblem.NullLocalVariableReference);
 	if (severity == ProblemSeverities.Ignore) return;
 	String[] arguments = new String[] {new String(local.name)  };
@@ -6179,6 +6189,10 @@
 }
 
 public void localVariablePotentialNullReference(LocalVariableBinding local, ASTNode location) {
+	if (location instanceof Expression && (((Expression)location).implicitConversion & TypeIds.UNBOXING) != 0) {
+		potentialNullUnboxing(location, local.type);
+		return;
+	}
 	int severity = computeSeverity(IProblem.PotentialNullLocalVariableReference);
 	if (severity == ProblemSeverities.Ignore) return;
 	String[] arguments = new String[] {new String(local.name)};
@@ -6198,7 +6212,16 @@
 		nodeSourceStart(local, location),
 		nodeSourceEnd(local, location));
 }
-
+public void potentialNullUnboxing(ASTNode expression, TypeBinding boxType) {
+	String[] arguments = new String[] { String.valueOf(boxType.readableName()) };
+	String[] argumentsShort = new String[] { String.valueOf(boxType.shortReadableName()) };
+	this.handle(IProblem.PotentialNullUnboxing, arguments, argumentsShort, expression.sourceStart, expression.sourceEnd);
+}
+public void nullUnboxing(ASTNode expression, TypeBinding boxType) {
+	String[] arguments = new String[] { String.valueOf(boxType.readableName()) };
+	String[] argumentsShort = new String[] { String.valueOf(boxType.shortReadableName()) };
+	this.handle(IProblem.NullUnboxing, arguments, argumentsShort, expression.sourceStart, expression.sourceEnd);
+}
 public void nullableFieldDereference(VariableBinding variable, long position) {
 	String[] arguments = new String[] {new String(variable.name)};
 	char[][] nullableName = this.options.nullableAnnotationName;
@@ -8912,7 +8935,7 @@
 	int severity = computeSeverity(IProblem.UnusedPrivateConstructor);
 	if (severity == ProblemSeverities.Ignore) return;
 	
-	if (excludeDueToAnnotation(constructorDecl.annotations)) return;
+	if (excludeDueToAnnotation(constructorDecl.annotations, IProblem.UnusedPrivateConstructor)) return;
 	
 	MethodBinding constructor = constructorDecl.binding;
 	this.handle(
@@ -8959,7 +8982,7 @@
 			}
 		}
 	}
-	if (excludeDueToAnnotation(fieldDecl.annotations)) return;
+	if (excludeDueToAnnotation(fieldDecl.annotations, IProblem.UnusedPrivateField)) return;
 	this.handle(
 			IProblem.UnusedPrivateField,
 		new String[] {
@@ -9013,7 +9036,7 @@
 			&& CharOperation.equals(method.selector, TypeConstants.WRITEREPLACE)) {
 		return;
 	}
-	if (excludeDueToAnnotation(methodDecl.annotations)) return;
+	if (excludeDueToAnnotation(methodDecl.annotations, IProblem.UnusedPrivateMethod)) return;
 	
 	this.handle(
 			IProblem.UnusedPrivateMethod,
@@ -9035,9 +9058,10 @@
 /**
  * Returns true if a private member should not be warned as unused if
  * annotated with a non-standard annotation.
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=365437
+ * https://bugs.eclipse.org/365437
+ * https://bugs.eclipse.org/376590
  */
-private boolean excludeDueToAnnotation(Annotation[] annotations) {
+private boolean excludeDueToAnnotation(Annotation[] annotations, int problemId) {
 	int annotationsLen = 0;
 	if (annotations != null) {
 		annotationsLen = annotations.length;
@@ -9056,6 +9080,11 @@
 				case TypeIds.T_ConfiguredAnnotationNullable:
 				case TypeIds.T_ConfiguredAnnotationNonNullByDefault:
 					break;
+				case TypeIds.T_JavaxInjectInject:
+				case TypeIds.T_ComGoogleInjectInject:
+					if (problemId != IProblem.UnusedPrivateField)
+						return true; // @Inject on method/ctor does constitute a relevant use, just on fields it doesn't
+					break;
 				default:
 					// non-standard annotation found, don't warn
 					return true;
@@ -9072,7 +9101,7 @@
 // SH}
 	int severity = computeSeverity(IProblem.UnusedPrivateType);
 	if (severity == ProblemSeverities.Ignore) return;
-	if (excludeDueToAnnotation(typeDecl.annotations)) return;
+	if (excludeDueToAnnotation(typeDecl.annotations, IProblem.UnusedPrivateType)) return;
 	ReferenceBinding type = typeDecl.binding;
 	this.handle(
 			IProblem.UnusedPrivateType,
@@ -13296,6 +13325,22 @@
 		location.sourceStart,
 		location.sourceEnd);
 }
+public void expressionNullReference(ASTNode location) {
+	this.handle(
+		IProblem.NullExpressionReference,
+		NoArgument,
+		NoArgument,
+		location.sourceStart,
+		location.sourceEnd);
+}
+public void expressionPotentialNullReference(ASTNode location) {
+	this.handle(
+		IProblem.PotentialNullExpressionReference,
+		NoArgument,
+		NoArgument,
+		location.sourceStart,
+		location.sourceEnd);
+}
 
 public void cannotImplementIncompatibleNullness(MethodBinding currentMethod, MethodBinding inheritedMethod) {
 	int sourceStart = 0, sourceEnd = 0;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties
index 6d860ae..0e85889 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties
@@ -34,6 +34,7 @@
 #							bug 402028 - [1.8][compiler] null analysis for reference expressions
 #							bug 401796 - [1.8][compiler] don't treat default methods as overriding an independent inherited abstract method
 #							bug 404649 - [1.8][compiler] detect illegal reference to indirect or redundant super
+#							bug 400761 - [compiler][null] null may be return as boolean without a diagnostic
 #		Jesper S Moller <jesper@selskabet.org> - Contributions for
 #							bug 382701 - [1.8][compiler] Implement semantic analysis of Lambda expressions & Reference expression
 #							bug 384567 - [1.5][compiler] Compiler accepts illegal modifiers on package declaration
@@ -429,7 +430,8 @@
 456 = instanceof always yields false: The variable {0} can only be null at this location
 457 = Redundant null check: The variable {0} cannot be null at this location
 458 = Null comparison always yields false: The variable {0} cannot be null at this location
-
+459 = Potential null pointer access: This expression of type {0} may be null but requires auto-unboxing
+461 = Null pointer access: This expression of type {0} is null but requires auto-unboxing
 460 = Empty block should be documented
 
 ### DOC
@@ -648,6 +650,8 @@
 ### NULL ANALYSIS FOR OTHER EXPRESSIONS
 670 = Null comparison always yields false: this expression cannot be null
 671 = Redundant null check: this expression cannot be null
+672 = Null pointer access: This expression can only be null
+673 = Potential null pointer access: This expression may be null
 
 ### CORRUPTED BINARIES
 700 = The class file {0} contains a signature ''{1}'' ill-formed at position {2}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/QualifiedBaseReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/QualifiedBaseReference.java
index 9e5dc8f..f6e93c7 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/QualifiedBaseReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/QualifiedBaseReference.java
@@ -49,15 +49,17 @@
 		TypeBinding superResult = super.resolveType(scope);
 		if (superResult == null || !superResult.isValidBinding())
 			return null;
-		if (this.currentCompatibleType != null && this.currentCompatibleType.isValidBinding()) {
-			this.baseField = this.currentCompatibleType.getField(IOTConstants._OT_BASE, true);
+		ReferenceBinding currentType = this.currentCompatibleType;
+		while (currentType != null && currentType.isValidBinding() && currentType.isRole()) {
+			this.baseField = currentType.getField(IOTConstants._OT_BASE, true);
 			if (this.baseField != null) {
 				if (this.baseField.isValidBinding())
 					return this.resolvedType = this.baseField.type;
-			} else {
-				this.baseField = new ProblemFieldBinding((ReferenceBinding)this.resolvedType, IOTConstants.BASE, ProblemReasons.NotFound);
 			}
-		}		
+			currentType = currentType.superclass(); // base field may be inherited
+		}
+		if (this.baseField == null)
+			this.baseField = new ProblemFieldBinding((ReferenceBinding)this.resolvedType, IOTConstants.BASE, ProblemReasons.NotFound);
 		scope.problemReporter().unboundQualifiedBase((ReferenceBinding)this.qualification.resolvedType, this);
 		return null; 
 	}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/Dependencies.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/Dependencies.java
index 73fe3b4..8e9fc4b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/Dependencies.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/Dependencies.java
@@ -305,6 +305,7 @@
 		    	case STATE_LENV_CHECK_AND_SET_IMPORTS:
 		    	case STATE_LENV_CONNECT_TYPE_HIERARCHY:
 		    	case STATE_LENV_DONE_FIELDS_AND_METHODS:
+		    	case STATE_ROLES_LINKED:
 		    		checkReadKnownRoles(unit);
 		    		LookupEnvironment lookupEnvironment= Config.getLookupEnvironment();
 		    		if (Config.getBundledCompleteTypeBindingsMode()) {
@@ -336,6 +337,8 @@
 	            		if (Config.getBuildFieldsAndMethods())
 	            			unit.scope.buildFieldsAndMethods();
 	            		break;
+	            	case STATE_ROLES_LINKED:
+	            		RoleSplitter.linkRoles(unit);
 	    			}
 		    		break;
 		        case STATE_METHODS_PARSED:
@@ -734,10 +737,15 @@
 					success &= establishRoleSplit(model);
 					break;
 				case STATE_ROLES_LINKED:
-					RoleSplitter.linkScopes(model);
-					RoleSplitter.linkSuperAndBaseInIfc(model);
-                    success &= true; // redundant
-                    model.setState(STATE_ROLES_LINKED);
+					// normally a CUD state, except for late roles
+					if (isLateRole(model, nextState)) {
+						if (model.getAst() != null)
+							RoleSplitter.linkRoles(model.getAst());
+						model.setState(nextState);
+						model.setMemberState(nextState);
+					} else {
+						success &= ensureUnitState(model, nextState);
+					}
 					break;
 				case STATE_ROLE_INIT_METHODS:
 					success &= establishRoleInitializationMethod(model);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/ITranslationStates.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/ITranslationStates.java
index 93ee0e9..0d37de4 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/ITranslationStates.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/ITranslationStates.java
@@ -42,7 +42,7 @@
 	public static final int STATE_LENV_CHECK_AND_SET_IMPORTS=   5;//LookupEnvironment & Deps.
 	public static final int STATE_LENV_CONNECT_TYPE_HIERARCHY=  6;//LookupEnvironment & Deps. & CopyInheritance
 	public static final int STATE_LENV_DONE_FIELDS_AND_METHODS= 7;//LookupEnvironment & Deps.
-	public static final int STATE_ROLES_LINKED            =  8;//CopyInheritance & Deps.
+	public static final int STATE_ROLES_LINKED            =  8;//LookupEnvironment & RoleSplitter
 	public static final int STATE_METHODS_PARSED          =  9;//Compiler
 	public static final int STATE_ROLE_INIT_METHODS       = 10;//RoleInitializationMethod
     public static final int STATE_ROLE_FEATURES_COPIED    = 11;//Copy inheritance
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/StateHelper.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/StateHelper.java
index 156f531..02be601 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/StateHelper.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/StateHelper.java
@@ -78,6 +78,7 @@
 		case STATE_LENV_CHECK_AND_SET_IMPORTS:
 		case STATE_LENV_CONNECT_TYPE_HIERARCHY:
 		case STATE_LENV_DONE_FIELDS_AND_METHODS:
+		case STATE_ROLES_LINKED:
 		case STATE_ROLE_FILES_LINKED:
 		case STATE_METHODS_PARSED:
 		case STATE_METHODS_VERIFIED:
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/StateMemento.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/StateMemento.java
index 2e9f3fb..264172e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/StateMemento.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/StateMemento.java
@@ -130,7 +130,7 @@
 		if (state < this._currentlyProcessingState)
 			return false;
 		// FIXME(SH): obsolete after integrating both state models?
-		if (state >= ITranslationStates.STATE_LENV_BUILD_TYPE_HIERARCHY && state <= ITranslationStates.STATE_LENV_DONE_FIELDS_AND_METHODS)
+		if (state >= ITranslationStates.STATE_LENV_BUILD_TYPE_HIERARCHY && state <= ITranslationStates.STATE_ROLES_LINKED)
 			return step < this._completingBindingsStep;
 		return true;
 	}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/lifting/Lifting.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/lifting/Lifting.java
index caf2d21..202be9b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/lifting/Lifting.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/lifting/Lifting.java
@@ -1,7 +1,7 @@
 /**********************************************************************
  * This file is part of "Object Teams Development Tooling"-Software
  *
- * Copyright 2003, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * Copyright 2003, 2013 Fraunhofer Gesellschaft, Munich, Germany,
  * for its Fraunhofer Institute for Computer Architecture and Software
  * Technology (FIRST), Berlin, Germany and Technical University Berlin,
  * Germany.
@@ -10,7 +10,6 @@
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * $Id: Lifting.java 23416 2010-02-03 19:59:31Z stephan $
  *
  * Please visit http://www.eclipse.org/objectteams for updates and contact.
  *
@@ -111,7 +110,6 @@
  *
  *
  * @author brcan, haebor, mac, stephan
- * @version $Id: Lifting.java 23416 2010-02-03 19:59:31Z stephan $
  */
 public class Lifting extends SwitchOnBaseTypeGenerator
 					 implements TypeIds, ClassFileConstants, ExtraCompilerModifiers
@@ -265,6 +263,7 @@
         AstGenerator gen = existingConstructor == null
         			? new AstGenerator(roleType)
         			: new AstGenerator(existingConstructor);
+        gen.replaceableEnclosingClass = roleType.binding.enclosingType();
         // public MyRole(MyBase base)
         ConstructorDeclaration generatedConstructor =
             gen.constructor(teamTypeDeclaration.compilationResult,
@@ -637,6 +636,7 @@
 
         this._boundRootRoleModel = boundRootRoleNode.getTreeObject();
         this._gen = new AstGenerator(typeDecl.sourceStart, typeDecl.sourceEnd);
+        this._gen.replaceableEnclosingClass = teamTypeDeclaration.binding;
         this._sourceLevel= typeDecl.scope.compilerOptions().sourceLevel;
 
         try {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/lookup/AnchorMapping.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/lookup/AnchorMapping.java
index 6f99479..7b71c84 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/lookup/AnchorMapping.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/lookup/AnchorMapping.java
@@ -261,8 +261,9 @@
 	          		anchor = null; // cancel if incompatible.
 		   }
 	   }
-	return anchor;
-}
+	   return anchor;
+   }
+
    // if anchor is valid return it otherwise null 
    private ITeamAnchor validAnchor(ITeamAnchor anchor) {
 	   if (  (anchor != null)
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CallinImplementor.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CallinImplementor.java
index 20959f3..73948d9 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CallinImplementor.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CallinImplementor.java
@@ -1,7 +1,7 @@
 /**********************************************************************
  * This file is part of "Object Teams Development Tooling"-Software
  *
- * Copyright 2003, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * Copyright 2003, 2013 Fraunhofer Gesellschaft, Munich, Germany,
  * for its Fraunhofer Institute for Computer Architecture and Software
  * Technology (FIRST), Berlin, Germany and Technical University Berlin,
  * Germany.
@@ -10,7 +10,6 @@
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * $Id: CallinImplementor.java 23416 2010-02-03 19:59:31Z stephan $
  *
  * Please visit http://www.eclipse.org/objectteams for updates and contact.
  *
@@ -244,6 +243,7 @@
 		final AstGenerator gen = new AstGenerator(
 				callinBindingDeclaration.roleMethodSpec.sourceStart,
 				callinBindingDeclaration.roleMethodSpec.sourceEnd);
+		gen.replaceableEnclosingClass = teamDecl.binding;
 		if (this._role.getClassPartBinding() != null)
 			gen.replaceableBaseAnchor = this._role.getClassPartBinding().getField(IOTConstants._OT_BASE, true);
 
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/copyinheritance/CopyInheritance.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/copyinheritance/CopyInheritance.java
index 9b4a640..04ed96e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/copyinheritance/CopyInheritance.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/copyinheritance/CopyInheritance.java
@@ -1,7 +1,7 @@
 /**********************************************************************
  * This file is part of "Object Teams Development Tooling"-Software
  *
- * Copyright 2003, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * Copyright 2003, 2013 Fraunhofer Gesellschaft, Munich, Germany,
  * for its Fraunhofer Institute for Computer Architecture and Software
  * Technology (FIRST), Berlin, Germany and Technical University Berlin,
  * Germany.
@@ -10,7 +10,6 @@
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * $Id: CopyInheritance.java 23417 2010-02-03 20:13:55Z stephan $
  *
  * Please visit http://www.eclipse.org/objectteams for updates and contact.
  *
@@ -176,7 +175,6 @@
  *
  *
  * @author Markus Witte
- * @version $Id: CopyInheritance.java 23417 2010-02-03 20:13:55Z stephan $
  */
 public class CopyInheritance implements IOTConstants, ClassFileConstants, ExtraCompilerModifiers, ITranslationStates
 {
@@ -1378,6 +1376,7 @@
 			}
         }
         AstGenerator gen = new AstGenerator(roleDeclaration.sourceStart, roleDeclaration.sourceEnd);
+	    gen.replaceableEnclosingClass = roleDeclaration.binding.enclosingType();
         FieldDeclaration fieldDeclaration =
                 AstConverter.createField(field, roleDeclaration, gen);
         AstEdit.addField(roleDeclaration,fieldDeclaration, true, false/*typeProblem*/, false);
@@ -1440,6 +1439,7 @@
 	    }
 
 	    AstGenerator gen = new AstGenerator(start, end);
+	    gen.replaceableEnclosingClass = teamDeclaration.binding;
 
 	    Argument[] newArguments = null;
 	    // Arguments (construct from bindings, using dummy names):
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/transformer/RoleSplitter.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/transformer/RoleSplitter.java
index 18e5aad..5a21efb 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/transformer/RoleSplitter.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/transformer/RoleSplitter.java
@@ -36,6 +36,7 @@
 import org.eclipse.jdt.internal.codeassist.complete.CompletionOnSingleTypeReference;
 import org.eclipse.jdt.internal.compiler.ast.ASTNode;
 import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
 import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
 import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
 import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference;
@@ -52,9 +53,9 @@
 import org.eclipse.objectteams.otdt.core.compiler.IOTConstants;
 import org.eclipse.objectteams.otdt.internal.core.compiler.control.ITranslationStates;
 import org.eclipse.objectteams.otdt.internal.core.compiler.model.MethodModel;
+import org.eclipse.objectteams.otdt.internal.core.compiler.model.MethodModel.ProblemDetail;
 import org.eclipse.objectteams.otdt.internal.core.compiler.model.RoleModel;
 import org.eclipse.objectteams.otdt.internal.core.compiler.model.TypeModel;
-import org.eclipse.objectteams.otdt.internal.core.compiler.model.MethodModel.ProblemDetail;
 import org.eclipse.objectteams.otdt.internal.core.compiler.util.AstClone;
 import org.eclipse.objectteams.otdt.internal.core.compiler.util.AstConverter;
 import org.eclipse.objectteams.otdt.internal.core.compiler.util.AstEdit;
@@ -397,7 +398,26 @@
 
     }
 
+    /** 
+     * API for LookupEnvironment:
+     * Establish necessary links between ifc- and class-part of each role in the given unit.
+     */
+    public static void linkRoles(CompilationUnitDeclaration unit) {
+		if (unit.types != null)
+			for (TypeDeclaration type : unit.types)
+				linkRoles(type);
+    }
 
+	public static void linkRoles(TypeDeclaration type) {
+		if (type.isRole()) {
+			RoleModel model = type.getRoleModel();
+			RoleSplitter.linkScopes(model);
+			RoleSplitter.linkSuperAndBaseInIfc(model);
+		}
+		if (type.memberTypes != null)
+			for (TypeDeclaration member : type.memberTypes)
+				linkRoles(member);		
+	}
 
 	/**
 	 * After roles have been split and bindings have been completed, transfer
@@ -406,11 +426,12 @@
 	 * Note: tsuper roles are not yet copied. We might need to adjust types from
 	 * super team to current team later (CopyInheritance.TypeLevel.adjustSuperinterfaces).
      */
-	public static void linkSuperAndBaseInIfc(RoleModel role) {
+	private static void linkSuperAndBaseInIfc(RoleModel role) {
 		if (!role.isSourceRole())
 			return; // local type nested in a proper role
-		if (role.getBinding().isBinaryBinding())
-			return; // already linked.
+		ReferenceBinding binding = role.getBinding();
+		if (binding == null || binding.isBinaryBinding())
+			return; // no hope or already linked.
 
 		ReferenceBinding classPart = role.getClassPartBinding();
 		ReferenceBinding ifcPart = role.getInterfacePartBinding();
@@ -451,7 +472,7 @@
 	 * which may appear in interface signatures).
 	 * @param model
 	 */
-	public static void linkScopes(RoleModel model) {
+	private static void linkScopes(RoleModel model) {
 		if (model._classPart != null && model._interfacePart != null) {
 			// may already have error
 			// (we observed duplicateNestedType, nestedHidesEnclosing)
@@ -462,8 +483,6 @@
 		}
 	}
 
-
-
 	public static boolean isClassPartName(char[] typeName) {
 		return CharOperation.prefixEquals(OT_DELIM_NAME, typeName);
 	}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/transformer/StandardElementGenerator.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/transformer/StandardElementGenerator.java
index 6b9b49f..0e14a2c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/transformer/StandardElementGenerator.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/transformer/StandardElementGenerator.java
@@ -1,7 +1,7 @@
 /**********************************************************************
  * This file is part of "Object Teams Development Tooling"-Software
  *
- * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * Copyright 2004, 2013 Fraunhofer Gesellschaft, Munich, Germany,
  * for its Fraunhofer Institute for Computer Architecture and Software
  * Technology (FIRST), Berlin, Germany and Technical University Berlin,
  * Germany.
@@ -10,7 +10,6 @@
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * $Id: StandardElementGenerator.java 23416 2010-02-03 19:59:31Z stephan $
  *
  * Please visit http://www.eclipse.org/objectteams for updates and contact.
  *
@@ -88,7 +87,6 @@
  *   - generates getfield of real inherited field plus a checkcast to compensate for weakening
  *
  * @author stephan
- * @version $Id: StandardElementGenerator.java 23416 2010-02-03 19:59:31Z stephan $
  */
 public class StandardElementGenerator {
 
@@ -602,6 +600,7 @@
 		AstGenerator gen= roleType.baseclass != null
 							 ? new AstGenerator(roleType.baseclass)
 							 : new AstGenerator(roleType);
+		gen.replaceableEnclosingClass = roleType.binding.enclosingType();
 		ReferenceBinding superRole = roleType.binding.superclass;
 		if (   superRole != null              // has parent
 			&& superRole.isRole()             // parent is role
@@ -698,6 +697,7 @@
 		AstGenerator gen = roleType.baseclass != null ?
 			new AstGenerator(roleType.baseclass.sourceStart, roleType.baseclass.sourceEnd) :
 			new AstGenerator(roleType.sourceStart, roleType.sourceEnd);
+		gen.replaceableEnclosingClass = roleType.binding.enclosingType();
 
 		TypeReference baseclassReference; // must set in if or else
 		TypeParameter methodParam = null;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/util/RoleTypeCreator.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/util/RoleTypeCreator.java
index d59c199..ca2c67e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/util/RoleTypeCreator.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/util/RoleTypeCreator.java
@@ -236,8 +236,8 @@
         if (typedNode instanceof Expression)
         	decapsulationAllowed = ((Expression)typedNode).getBaseclassDecapsulation().isAllowed();
         	
-        if (   (variableBinding instanceof VariableBinding) 
-			&& (((VariableBinding)variableBinding).tagBits & TagBits.IsFreshTeamInstance) != 0) 
+        if (   (variableBinding instanceof LocalVariableBinding) // note that for FieldBinding Bit63L has a different meaning!
+			&& (((LocalVariableBinding)variableBinding).tagBits & TagBits.IsFreshTeamInstance) != 0) 
         {
         	if (!RoleTypeBinding.isRoleType(refBinding))
         		return variableBinding.getDependentTypeBinding(refBinding, -1, null, dimensions);
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java
index a155f7b..dd8f2ea 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java
@@ -1761,6 +1761,8 @@
 			if (node instanceof ParameterizedQualifiedTypeReference) {
  				ParameterizedQualifiedTypeReference typeReference = (ParameterizedQualifiedTypeReference) node;
 				org.eclipse.jdt.internal.compiler.lookup.TypeBinding typeBinding = typeReference.resolvedType;
+				// This unlikely case is possible when for some reason binding resolution has been stopped, like duplicate type declaration (bug 376440)
+				if (typeBinding == null) return null;
 				if (type.isArrayType()) {
 					if (this.scope == null) {
 						return null;
diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetThisReference.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetThisReference.java
index 9bbe45a..5a41e10 100644
--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetThisReference.java
+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetThisReference.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -7,6 +7,8 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Jesper S Moller - Contributions for
+ *								Bug 378674 - "The method can be declared as static" is wrong
  *******************************************************************************/
 package org.eclipse.jdt.internal.eval;
 
@@ -54,6 +56,7 @@
 			methodScope.problemReporter().errorThisSuperInStatic(this);
 			return false;
 		}
+		methodScope.resetEnclosingMethodStaticFlag();
 		return true;
 	}
 	
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IAccessRule.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IAccessRule.java
index db57fac..12f4e3b 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IAccessRule.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IAccessRule.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -19,17 +19,19 @@
  * <p>
  * On a given classpath entry, the access rules are considered in the order given
  * when the entry was created. When a source or class file matches an access
- * rule's pattern, the access rule's kind define whether the file is considered
- * accessible, non accessible, or its access is discouraged. If the source or class
- * file doesn't match any accessible rule, it is considered accessible. A source or class
- * file that is not accessible or discouraged can still be refered to but it is tagged as being not
- * accessible - the Java builder will create a problem marker for example.
- * The severity of the marker created from a non accessible rule is controled through
+ * rule's pattern, the access rule's kind defines whether the file is considered
+ * accessible, non-accessible, or whether its access is discouraged. If the source or class
+ * file doesn't match any access rule, it is considered accessible. A source or class
+ * file that is not accessible or discouraged can still be referred to, but it is tagged as being not
+ * accessible - the Java builder will create a problem marker, for example.
+ * The severity of the marker created from a non-accessible rule is controlled through
  * the {@link JavaCore#COMPILER_PB_FORBIDDEN_REFERENCE} compiler option.
- * The severity of the marker created from a discouraged rule is controled through
+ * The severity of the marker created from a discouraged rule is controlled through
  * the {@link JavaCore#COMPILER_PB_DISCOURAGED_REFERENCE} compiler option.
  * Note this is different from inclusion and exclusion patterns on source classpath entries,
  * where a source file that is excluded is not even compiled.
+ * </p>
+ * <p>
  * Files patterns look like relative file paths with wildcards and are interpreted relative
  * to each entry's path.
  * File patterns are case-sensitive and they can contain '**', '*' or '?' wildcards (see
@@ -40,8 +42,8 @@
  * <code>com/xyz/tests/MyClass.class</code> is not valid.
  * </p>
  * <p>
- * For example, if one of the entry path is <code>/Project/someLib.jar</code>,
- * there are no accessible rules, and there is one non accessible rule whith pattern
+ * For example, if a classpath entry path is <code>/Project/someLib.jar</code>,
+ * there are no accessible rules, and there is one non-accessible rule with pattern
  * <code>com/xyz/tests/&#42;&#42;</code>, then class files
  * like <code>/Project/someLib.jar/com/xyz/Foo.class</code>
  * and <code>/Project/someLib.jar/com/xyz/utils/Bar.class</code> would be accessible,
@@ -49,11 +51,13 @@
  * and <code>/Project/someLib.jar/com/xyz/tests/quick/T2.class</code> would not be
  * accessible.
  * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
  *
  * @since 3.1
+ * 
+ * @see JavaCore#newAccessRule(IPath, int)
+ * @see IClasspathEntry#getExclusionPatterns()
+ * 
+ * @noimplement This interface is not intended to be implemented by clients.
  */
 public interface IAccessRule {
 
@@ -63,7 +67,7 @@
 	int K_ACCESSIBLE = 0;
 
 	/**
-	 * Constant indicating that files matching the rule's pattern are non accessible.
+	 * Constant indicating that files matching the rule's pattern are non-accessible.
 	 */
 	int K_NON_ACCESSIBLE = 1;
 
@@ -90,6 +94,8 @@
 	 * Returns the file pattern for this access rule.
 	 *
 	 * @return the file pattern for this access rule
+	 *
+	 * @see IClasspathEntry#getExclusionPatterns()
 	 */
 	IPath getPattern();
 
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IAnnotatable.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IAnnotatable.java
index 6e50103..a9765a8 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IAnnotatable.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IAnnotatable.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -12,11 +12,9 @@
 
 /**
  * Common protocol for Java elements that can be annotated.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
  *
  * @since 3.4
+ * @noimplement This interface is not intended to be implemented by clients.
  */
 public interface IAnnotatable {
 
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IAnnotation.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IAnnotation.java
index ce06623..36dca8f 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IAnnotation.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IAnnotation.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -19,11 +19,9 @@
  * Note that annotations are not children of their declaring element.
  * To get a list of the annotations use {@link IAnnotatable#getAnnotations()}.
  * </p>
- * <p>
- * This interface is not intended to be implemented or extended by clients.
- * </p>
  *
  * @since 3.4
+ * @noimplement This interface is not intended to be implemented by clients.
  */
 public interface IAnnotation extends IJavaElement, ISourceReference {
 
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
index adf7497..57736e2 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
@@ -129,7 +129,6 @@
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.SubProgressMonitor;
 import org.eclipse.core.runtime.jobs.ISchedulingRule;
-
 import org.eclipse.core.resources.IContainer;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IFolder;
@@ -143,7 +142,6 @@
 import org.eclipse.core.resources.IWorkspaceRoot;
 import org.eclipse.core.resources.IWorkspaceRunnable;
 import org.eclipse.core.resources.ResourcesPlugin;
-
 import org.eclipse.jdt.core.compiler.CharOperation;
 import org.eclipse.jdt.core.compiler.IProblem;
 import org.eclipse.jdt.core.search.IJavaSearchConstants;
@@ -151,7 +149,6 @@
 import org.eclipse.jdt.core.search.SearchEngine;
 import org.eclipse.jdt.core.search.SearchPattern;
 import org.eclipse.jdt.core.search.TypeNameRequestor;
-
 import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
 import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
 import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
@@ -4314,7 +4311,7 @@
 	 * <p>
 	 * The rule kind is one of {@link IAccessRule#K_ACCESSIBLE}, {@link IAccessRule#K_DISCOURAGED},
 	 * or {@link IAccessRule#K_NON_ACCESSIBLE}, optionally combined with {@link IAccessRule#IGNORE_IF_BETTER},
-	 * e..g. <code>IAccessRule.K_NON_ACCESSIBLE | IAccessRule.IGNORE_IF_BETTER</code>.
+	 * e.g. <code>IAccessRule.K_NON_ACCESSIBLE | IAccessRule.IGNORE_IF_BETTER</code>.
 	 * </p>
 	 *
 	 * @param filePattern the file pattern this access rule should match
@@ -4323,6 +4320,8 @@
 	 *                     {@link IAccessRule#IGNORE_IF_BETTER}
 	 * @return a new access rule
 	 * @since 3.1
+	 * 
+	 * @see IClasspathEntry#getExclusionPatterns()
 	 */
 	public static IAccessRule newAccessRule(IPath filePattern, int kind) {
 		return new ClasspathAccessRule(filePattern, kind);
@@ -5664,4 +5663,4 @@
 		super.start(context);
 		JavaModelManager.getJavaModelManager().startup();
 	}
-}
\ No newline at end of file
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java
index 1d1fd29..09e67fd 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java
@@ -84,21 +84,51 @@
 			argumentNames[j] = ("arg" + j).toCharArray(); //$NON-NLS-1$
 		}
 	}
+	int startIndex = 0;
+	try {
+		if (isConstructor()) {
+			IType declaringType = this.getDeclaringType();
+			if (declaringType.isEnum()) {
+				startIndex = 2;
+			} else if (declaringType.isMember()
+					&& !Flags.isStatic(declaringType.getFlags())) {
+				startIndex = 1;
+			}
+		}
+	} catch(JavaModelException e) {
+		// ignore
+	}
 	for (int i= 0; i < length; i++) {
-		LocalVariable localVariable = new LocalVariable(
-				this,
-				new String(argumentNames[i]),
-				0,
-				-1,
-				0,
-				-1,
-				this.parameterTypes[i],
-				null,
-				-1,
-				true);
-		localVariables[i] = localVariable;
-		IAnnotation[] annotations = getAnnotations(localVariable, info.getParameterAnnotations(i));
-		localVariable.annotations = annotations;
+		if (i < startIndex) {
+			LocalVariable localVariable = new LocalVariable(
+					this,
+					new String(argumentNames[i]),
+					0,
+					-1,
+					0,
+					-1,
+					this.parameterTypes[i],
+					null,
+					-1,
+					true);
+			localVariables[i] = localVariable;
+			localVariable.annotations = Annotation.NO_ANNOTATIONS;
+		} else {
+			LocalVariable localVariable = new LocalVariable(
+					this,
+					new String(argumentNames[i]),
+					0,
+					-1,
+					0,
+					-1,
+					this.parameterTypes[i],
+					null,
+					-1,
+					true);
+			localVariables[i] = localVariable;
+			IAnnotation[] annotations = getAnnotations(localVariable, info.getParameterAnnotations(i - startIndex));
+			localVariable.annotations = annotations;
+		}
 	}
 	return localVariables;
 }
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java
index c59efc3..9c06306 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java
@@ -429,8 +429,21 @@
 				argumentNames[j] = ("arg" + j).toCharArray(); //$NON-NLS-1$
 			}
 		}
-		for (int j = 0; j < max; j++) {
-			IBinaryAnnotation[] parameterAnnotations = methodInfo.getParameterAnnotations(j);
+		int startIndex = 0;
+		try {
+			if (isConstructor) {
+				if (type.isEnum()) {
+					startIndex = 2;
+				} else if (type.isMember()
+						&& !Flags.isStatic(type.getFlags())) {
+					startIndex = 1;
+				}
+			}
+		} catch(JavaModelException e) {
+			// ignore
+		}
+		for (int j = startIndex; j < max; j++) {
+			IBinaryAnnotation[] parameterAnnotations = methodInfo.getParameterAnnotations(j - startIndex);
 			if (parameterAnnotations != null) {
 				LocalVariable localVariable = new LocalVariable(
 						method,
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java
index 458fbda..e596ffc 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java
@@ -18,24 +18,26 @@
 
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.OperationCanceledException;
+
 import org.eclipse.jdt.core.*;
 import org.eclipse.jdt.core.compiler.CategorizedProblem;
 import org.eclipse.jdt.internal.compiler.*;
 import org.eclipse.jdt.internal.compiler.Compiler;
+import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
 import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
 import org.eclipse.jdt.internal.compiler.env.AccessRestriction;
 import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
 import org.eclipse.jdt.internal.compiler.env.ISourceType;
 import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
 import org.eclipse.jdt.internal.compiler.lookup.PackageBinding;
 import org.eclipse.jdt.internal.compiler.parser.SourceTypeConverter;
 import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
 import org.eclipse.jdt.internal.compiler.problem.DefaultProblem;
+import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
 import org.eclipse.jdt.internal.core.util.CommentRecorderParser;
 import org.eclipse.jdt.internal.core.util.Util;
-import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
-import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
-import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
+
 import org.eclipse.objectteams.otdt.internal.core.compiler.control.Config;
 import org.eclipse.objectteams.otdt.internal.core.compiler.control.Dependencies;
 
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElement.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElement.java
index 71d8660..68abebb 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElement.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElement.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -878,14 +878,21 @@
 		} catch (MalformedURLException e) {
 			throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.CANNOT_RETRIEVE_ATTACHED_JAVADOC, this));
 		} catch (FileNotFoundException e) {
-			// ignore. see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=120559
-		} catch(SocketException e) {
-			// ignore. see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=247845
-		} catch(UnknownHostException e) {
-			// ignore. see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=247845
-		} catch(ProtocolException e) {
-			// ignore. see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=247845
-		} catch(IOException e) {
+			// Ignore, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=120559 &
+			// https://bugs.eclipse.org/bugs/show_bug.cgi?id=403036
+		} catch (SocketException e) {
+			// see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=247845 &
+			// https://bugs.eclipse.org/bugs/show_bug.cgi?id=400060
+			throw new JavaModelException(e, IJavaModelStatusConstants.CANNOT_RETRIEVE_ATTACHED_JAVADOC);
+		} catch (UnknownHostException e) {
+			// see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=247845 &
+			// https://bugs.eclipse.org/bugs/show_bug.cgi?id=400060
+			throw new JavaModelException(e, IJavaModelStatusConstants.CANNOT_RETRIEVE_ATTACHED_JAVADOC);
+		} catch (ProtocolException e) {
+			// see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=247845 &
+			// https://bugs.eclipse.org/bugs/show_bug.cgi?id=400060
+			throw new JavaModelException(e, IJavaModelStatusConstants.CANNOT_RETRIEVE_ATTACHED_JAVADOC);
+		} catch (IOException e) {
 			throw new JavaModelException(e, IJavaModelStatusConstants.IO_EXCEPTION);
 		} finally {
 			if (stream != null) {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java
index 5c5175e..32edad8 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java
@@ -963,10 +963,6 @@
 		// (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=145333)
 		try {
 			this.lookupEnvironment.completeTypeBindings(parsedUnits, hasLocalType, unitsIndex);
-//{ObjectTeams: additional step: this state creates more hierarchy-related links:
-			for (int i=0; i<unitsIndex; i++)
-				Dependencies.ensureState(parsedUnits[i], ITranslationStates.STATE_ROLES_LINKED);
-// SH}
 			// remember type bindings
 			for (int i = 0; i < unitsIndex; i++) {
 				CompilationUnitDeclaration parsedUnit = parsedUnits[i];
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java
index 59ad02d..4f9ebc2 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -737,10 +737,14 @@
 	return collector != null && collector.needsRefresh();
 }
 /**
- * Returns whether one of the subtypes in this hierarchy has the given simple name
- * or this type has the given simple name.
+ * Returns whether this type or one of the subtypes in this hierarchy has the
+ * same simple name as the given name.
  */
-private boolean hasSubtypeNamed(String simpleName) {
+private boolean hasSubtypeNamed(String name) {
+	int idx = -1;
+	String rawName = (idx = name.indexOf('<')) > -1 ? name.substring(0, idx) : name;
+	String simpleName = (idx = rawName.lastIndexOf('.')) > -1 ? rawName.substring(idx + 1) : rawName;
+
 	if (this.focusType != null && this.focusType.getElementName().equals(simpleName)) {
 		return true;
 	}
@@ -1471,11 +1475,7 @@
 	if (superclassName == null) {
 		superclassName = "Object"; //$NON-NLS-1$
 	}
-	int dot = -1;
-	String simpleSuper = (dot = superclassName.lastIndexOf('.')) > -1 ?
-		superclassName.substring(dot + 1) :
-		superclassName;
-	if (hasSubtypeNamed(simpleSuper)) {
+	if (hasSubtypeNamed(superclassName)) {
 		return true;
 	}
 
@@ -1489,12 +1489,8 @@
 		return false;
 	}
 	for (int i = 0, length = interfaceNames.length; i < length; i++) {
-		dot = -1;
 		String interfaceName = interfaceNames[i];
-		String simpleInterface = (dot = interfaceName.lastIndexOf('.')) > -1 ?
-			interfaceName.substring(dot) :
-			interfaceName;
-		if (hasSubtypeNamed(simpleInterface)) {
+		if (hasSubtypeNamed(interfaceName)) {
 			return true;
 		}
 	}
diff --git a/org.eclipse.jdt.core/pom.xml b/org.eclipse.jdt.core/pom.xml
index 3665462..16c9d59 100644
--- a/org.eclipse.jdt.core/pom.xml
+++ b/org.eclipse.jdt.core/pom.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-  Copyright (c) 2012 Eclipse Foundation.
+  Copyright (c) 2012, 2013 Eclipse Foundation and others.
   All rights reserved. This program and the accompanying materials
   are made available under the terms of the Eclipse Distribution License v1.0
   which accompanies this distribution, and is available at
@@ -19,7 +19,7 @@
     <groupId>eclipse.jdt.core</groupId>
     <version>3.8.0-SNAPSHOT</version>
   </parent>
-  <groupId>eclipse.jdt.core</groupId>
+  <groupId>org.eclipse.jdt</groupId>
   <artifactId>org.eclipse.jdt.core</artifactId>
   <version>3.9.0-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.objectteams.otdt.debug.ui/META-INF/MANIFEST.MF
index 7c1d638..ed445a6 100644
--- a/plugins/org.eclipse.objectteams.otdt.debug.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.objectteams.otdt.debug.ui;singleton:=true
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 2.2.0.qualifier
 Bundle-Activator: org.eclipse.objectteams.otdt.debug.ui.OTDebugUIPlugin
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.objectteams.otdt.debug/META-INF/MANIFEST.MF b/plugins/org.eclipse.objectteams.otdt.debug/META-INF/MANIFEST.MF
index a2fc805..e2d7c6e 100644
--- a/plugins/org.eclipse.objectteams.otdt.debug/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.objectteams.otdt.debug/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.objectteams.otdt.debug;singleton:=true
-Bundle-Version: 2.0.0.qualifier
+Bundle-Version: 2.2.0.qualifier
 Bundle-Activator: org.eclipse.objectteams.otdt.debug.OTDebugPlugin
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/assist/OTQuickFixes.java b/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/assist/OTQuickFixes.java
index 92c929e..705d847 100644
--- a/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/assist/OTQuickFixes.java
+++ b/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/assist/OTQuickFixes.java
@@ -564,8 +564,7 @@
 		}
 
 		@SuppressWarnings("decapsulation")
-		int getNeededVisibility(ASTNode currNode, ITypeBinding targetType) 
-			<- replace  int getNeededVisibility(ASTNode currNode, ITypeBinding targetType);
+		getNeededVisibility <- replace  getNeededVisibility;
 
 		@SuppressWarnings("basecall")
 		callin static int getNeededVisibility(ASTNode currNode, ITypeBinding targetType) {
diff --git a/plugins/org.eclipse.objectteams.otdt.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.objectteams.otdt.ui/META-INF/MANIFEST.MF
index 8beb734..e109f06 100644
--- a/plugins/org.eclipse.objectteams.otdt.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.objectteams.otdt.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.objectteams.otdt.ui;singleton:=true
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 2.2.0.qualifier
 Bundle-Activator: org.eclipse.objectteams.otdt.ui.OTDTUIPlugin
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.objectteams.otdt/about.ini b/plugins/org.eclipse.objectteams.otdt/about.ini
index 5395c79..55d58c3 100644
--- a/plugins/org.eclipse.objectteams.otdt/about.ini
+++ b/plugins/org.eclipse.objectteams.otdt/about.ini
@@ -1,6 +1,6 @@
 aboutText=Object Teams Development Tooling\n\
 \n\
-Version: 2.2.0 M5\n\
+Version: 2.2.0 M6\n\
 \n\
 Part of the Eclipse Kepler Simultaneous Release\n\
 \n\
diff --git a/plugins/org.eclipse.objectteams.otequinox/about.ini b/plugins/org.eclipse.objectteams.otequinox/about.ini
index d0c5125..067d107 100644
--- a/plugins/org.eclipse.objectteams.otequinox/about.ini
+++ b/plugins/org.eclipse.objectteams.otequinox/about.ini
@@ -1,6 +1,6 @@
 aboutText=Object Teams -- Equinox integration (OT/Equinox)\n\
 \n\
-Version: 2.2.0 M5\n\
+Version: 2.2.0 M6\n\
 \n\
 Part of the Eclipse Kepler Simultaneous Release\n\
 \n\
diff --git a/releng/build-scripts/build/compiler.OTDT-Build.properties b/releng/build-scripts/build/compiler.OTDT-Build.properties
index 1617872..965132c 100644
--- a/releng/build-scripts/build/compiler.OTDT-Build.properties
+++ b/releng/build-scripts/build/compiler.OTDT-Build.properties
@@ -1,7 +1,7 @@
 # Configure the build compiler for phase 2.
 # This file is read from build/build.xml
 build.compiler=org.eclipse.jdt.core.JDTCompilerAdapter
-compilerArg=-enableJavadoc -encoding ISO-8859-1
+compilerArg=-enableJavadoc -encoding UTF-8
 javaSource=1.5
 javacSource=1.5
 javacTarget=1.5
diff --git a/releng/build-scripts/build/otdt_prerequisites.sh b/releng/build-scripts/build/otdt_prerequisites.sh
index 75db6b8..fd94d32 100644
--- a/releng/build-scripts/build/otdt_prerequisites.sh
+++ b/releng/build-scripts/build/otdt_prerequisites.sh
@@ -20,6 +20,9 @@
 # EXPORT: tmp directory for logging:
 TMPDIR="${BASEDIR}/tmp"
 
+# EXPORT: tmp directory for test files:
+TEST_TMPDIR="${HOME}/tmp"
+
 # EXPORT: directory for metadata from previous builds:
 METADATA="${BASEDIR}/metadata"
 
@@ -48,11 +51,11 @@
 
 # VERSIONS:
 # Eclipse SDK build identifier:
-EVERSION=4.3M5
+EVERSION=4.3M6
 # Architecture (as used by OSGi):
 ARCH=`arch`
 # used only locally:
-DROP=${BASEDIR}/drops4/S-4.3M5-201301302000
+DROP=${BASEDIR}/drops4/S-4.3M6-201303141330
 
 
 # EXPORT: archive file of the base eclipse SDK build:
@@ -62,5 +65,5 @@
 ECLIPSE_TESTLIB_ZIP=${DROP}/eclipse-test-framework-${EVERSION}.zip
 
 # EXPORT: where to find previously published plugins&features:
-PUBLISHED_UPDATES=${HOME}/downloads/objectteams/updates/ot2.1
+PUBLISHED_UPDATES=${HOME}/downloads/objectteams/updates/ot2.2
 
diff --git a/releng/build-scripts/build/otdt_runtests.sh b/releng/build-scripts/build/otdt_runtests.sh
index 58fc310..544a959 100755
--- a/releng/build-scripts/build/otdt_runtests.sh
+++ b/releng/build-scripts/build/otdt_runtests.sh
@@ -15,6 +15,7 @@
 # INPUT: Variables from otdt_prerequisites:
 # -----------------------------------------------------------------------------
 # TMPDIR                for log output
+# TEST_TMPDIR           for temp test files
 # OT_TESTSUITE_DIR      root directory for building and testing
 # METADATA				directory for metadata from previous builds
 # OT_RECIPIENT          mail address for failure messages
@@ -90,6 +91,7 @@
 #LOCAL: Display to be used by VNC:
 VNC_DISPLAY=:23
 
+
 while test $# -gt 0; do
 	case "$1" in 
     -b)
@@ -105,6 +107,11 @@
 	    X11=X11
 		shift
 		;;
+	-tmp)
+        shift
+        TEST_TMPDIR="$1"
+        shift
+        ;;
 	*)
 		echo "Unknown argument: $1"
 		usage
@@ -144,7 +151,8 @@
     -Declipse.tests.zip=${ECLIPSE_TESTLIB_ZIP} \
     -Dpublished.updates=${PUBLISHED_UPDATES} \
     -Ddo.run.tests=${DO_RUN} \
-    -Ddo.build.all=${DO_BUILD}"
+    -Ddo.build.all=${DO_BUILD} \
+    -Dtest.tmpDir=${TEST_TMPDIR}"
 
 ANT_OPTS="-Xmx1024m"
 export ANT_OPTS
diff --git a/releng/build-scripts/build/run.properties b/releng/build-scripts/build/run.properties
index 8bbee54..2fcbbf0 100644
--- a/releng/build-scripts/build/run.properties
+++ b/releng/build-scripts/build/run.properties
@@ -22,12 +22,12 @@
 
 # ------------- insert current versions here ---------------
 # Details of the Eclipse SDK built upon:
-run.eclipseScriptDir=plugins/org.eclipse.pde.build_3.8.100.v20121022-201131/scripts
-org.eclipse.equinox.launcher_jar=org.eclipse.equinox.launcher_1.3.0.v20130125-144918.jar
+run.eclipseScriptDir=plugins/org.eclipse.pde.build_3.8.100.v20130225-1821/scripts
+org.eclipse.equinox.launcher_jar=org.eclipse.equinox.launcher_1.3.0.v20130225-1645.jar
 
 # for patching our patch feature to match this version with any suffix:
-jdt.feature.version=3.9.0.v20121210-1329
-jdt.feature.version.next=3.9.0.v20121210-1330
+jdt.feature.version=3.9.0.v20130314-1330
+jdt.feature.version.next=3.9.0.v20130314-1331
 # -----------------------------------------------------------
 
 #Git Support for PDE BUILD:
diff --git a/releng/build-scripts/build/run.xml b/releng/build-scripts/build/run.xml
index 2d709e7..7f9bd21 100644
--- a/releng/build-scripts/build/run.xml
+++ b/releng/build-scripts/build/run.xml
@@ -25,6 +25,8 @@
 		do.build.all     = ${do.build.all}
 should test be run (true|false)?
 		do.run.tests     = ${do.run.tests}
+directory for tempory files during testing:
+		test.tmpDir		 = ${test.tmpDir}
 ------------------------------------------------------------------------------
 		</echo>
 	</target>
@@ -343,6 +345,7 @@
 			<property name="basearch" value="${arch}" />
 			<property name="otdtUpdatesDir" value="${otdtUpdatesDir}" />
 			<property name="testsUpdatesDirBase" value="${testsUpdatesDirBase}" />
+			<property name="test.tmpDir" value="${test.tmpDir}"/>
 			<property name="vmargs" value="${vmargs}" />
 		</ant>
 	</target>
@@ -357,6 +360,7 @@
 			<property name="basearch" value="${arch}" />
 			<property name="otdtUpdatesDir" value="${otdtUpdatesDir}" />
 			<property name="testsUpdatesDirBase" value="${testsUpdatesDirBase}" />
+			<property name="test.tmpDir" value="${test.tmpDir}"/>
 			<property name="vmargs" value="${vmargs}" />
 		</ant>
 	</target>
diff --git a/releng/build-scripts/build/test.properties b/releng/build-scripts/build/test.properties
index 492ec58..eb042c3 100644
--- a/releng/build-scripts/build/test.properties
+++ b/releng/build-scripts/build/test.properties
@@ -2,11 +2,11 @@
 
 # pasted output from processSDKmap.sh:
 # ----
-org.eclipse.jdt.core.tests.builder=org.eclipse.jdt.core.tests.builder_3.8.2.v20130111-142029
-org.eclipse.jdt.debug.tests=org.eclipse.jdt.debug.tests_3.8.100.v20130128-162647
-org.eclipse.jdt.ui.tests=org.eclipse.jdt.ui.tests_3.9.0.v20130122-101722
-org.eclipse.jdt.ui.tests.refactoring=org.eclipse.jdt.ui.tests.refactoring_3.9.0.v20130114-093639
-org.eclipse.test.performance=org.eclipse.test.performance_3.7.0.v20130122-104832
+org.eclipse.jdt.core.tests.builder=org.eclipse.jdt.core.tests.builder_3.8.2.I20130314-1330
+org.eclipse.jdt.debug.tests=org.eclipse.jdt.debug.tests_3.8.100.I20130314-1330
+org.eclipse.jdt.ui.tests=org.eclipse.jdt.ui.tests_3.9.0.I20130314-1330
+org.eclipse.jdt.ui.tests.refactoring=org.eclipse.jdt.ui.tests.refactoring_3.9.0.I20130314-1330
+org.eclipse.test.performance=org.eclipse.test.performance_3.7.0.I20130314-1330
 # ----
 
 # tests referenced without version qualifier:
diff --git a/releng/build-scripts/build/test.xml b/releng/build-scripts/build/test.xml
index b5597d9..e89f0a2 100644
--- a/releng/build-scripts/build/test.xml
+++ b/releng/build-scripts/build/test.xml
@@ -59,7 +59,7 @@
 	>

 		<ant antfile="plugins/${testPlugin}/test.xml" dir="${test.eclipseDir}">

 			<property name="eclipse-home" value="${test.eclipseDir}" />

-            <property name="extraVMargs" value="-XX:MaxPermSize=320m -XX:+HeapDumpOnOutOfMemoryError"/>

+            <property name="extraVMargs" value="-XX:MaxPermSize=320m -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=${test.tmpDir}"/>

 		</ant>

 	</target>

 

diff --git a/releng/map/otdt.map b/releng/map/otdt.map
index 45c10ae..3541bea 100644
--- a/releng/map/otdt.map
+++ b/releng/map/otdt.map
@@ -12,9 +12,9 @@
 !next plug-in don't specify version so that org.eclipse.objectteams.runtime/customBuildCallbacks.xml will find the plug-in directory:

 plugin@org.eclipse.objectteams.otdt=GIT,repo=git://git.eclipse.org/gitroot/objectteams/org.eclipse.objectteams.git,path=plugins/org.eclipse.objectteams.otdt

 

-plugin@org.eclipse.objectteams.otdt.debug,2.0.0=GIT,repo=git://git.eclipse.org/gitroot/objectteams/org.eclipse.objectteams.git,path=plugins/org.eclipse.objectteams.otdt.debug

-plugin@org.eclipse.objectteams.otdt.debug.ui,2.1.0=GIT,repo=git://git.eclipse.org/gitroot/objectteams/org.eclipse.objectteams.git,path=plugins/org.eclipse.objectteams.otdt.debug.ui

-plugin@org.eclipse.objectteams.otdt.ui,2.1.0=GIT,repo=git://git.eclipse.org/gitroot/objectteams/org.eclipse.objectteams.git,path=plugins/org.eclipse.objectteams.otdt.ui

+plugin@org.eclipse.objectteams.otdt.debug,2.2.0=GIT,repo=git://git.eclipse.org/gitroot/objectteams/org.eclipse.objectteams.git,path=plugins/org.eclipse.objectteams.otdt.debug

+plugin@org.eclipse.objectteams.otdt.debug.ui,2.2.0=GIT,repo=git://git.eclipse.org/gitroot/objectteams/org.eclipse.objectteams.git,path=plugins/org.eclipse.objectteams.otdt.debug.ui

+plugin@org.eclipse.objectteams.otdt.ui,2.2.0=GIT,repo=git://git.eclipse.org/gitroot/objectteams/org.eclipse.objectteams.git,path=plugins/org.eclipse.objectteams.otdt.ui

 plugin@org.eclipse.objectteams.otdt.doc,2.1.0=GIT,repo=git://git.eclipse.org/gitroot/objectteams/org.eclipse.objectteams.git,path=plugins/org.eclipse.objectteams.otdt.doc,tag=builds/201206090452

 plugin@org.eclipse.objectteams.otdt.metrics,0.7.0=GIT,repo=git://git.eclipse.org/gitroot/objectteams/org.eclipse.objectteams.git,path=plugins/org.eclipse.objectteams.otdt.metrics,tag=builds/201101290806

 

@@ -61,11 +61,11 @@
 

 !-- Tests fetched from original GIT (some are required indirectly by jdt.ui.tests): --

 !   (these lines are generated from SDK map file using extractVersions)

-plugin@org.eclipse.jdt.core.tests.builder=GIT,tag=v20130111-142029,repo=git://git.eclipse.org/gitroot/jdt/eclipse.jdt.core.git,path=org.eclipse.jdt.core.tests.builder

-plugin@org.eclipse.jdt.debug.tests=GIT,tag=v20130128-162647,repo=git://git.eclipse.org/gitroot/jdt/eclipse.jdt.debug.git,path=org.eclipse.jdt.debug.tests

-plugin@org.eclipse.jdt.ui.tests=GIT,tag=v20130122-101722,repo=git://git.eclipse.org/gitroot/jdt/eclipse.jdt.ui.git,path=org.eclipse.jdt.ui.tests

-plugin@org.eclipse.jdt.ui.tests.refactoring=GIT,tag=v20130114-093639,repo=git://git.eclipse.org/gitroot/jdt/eclipse.jdt.ui.git,path=org.eclipse.jdt.ui.tests.refactoring

-plugin@org.eclipse.jdt.text.tests=GIT,tag=v20130122-120935,repo=git://git.eclipse.org/gitroot/jdt/eclipse.jdt.ui.git,path=org.eclipse.jdt.text.tests

-plugin@org.eclipse.jface.text.tests=GIT,tag=v20121210-150853,repo=git://git.eclipse.org/gitroot/platform/eclipse.platform.text.git,path=org.eclipse.jface.text.tests

-plugin@org.eclipse.text.tests=GIT,tag=v20121210-150853,repo=git://git.eclipse.org/gitroot/platform/eclipse.platform.text.git,path=org.eclipse.text.tests

-plugin@org.eclipse.core.filebuffers.tests=GIT,tag=v20120705-111822,repo=git://git.eclipse.org/gitroot/platform/eclipse.platform.text.git,path=org.eclipse.core.filebuffers.tests

+plugin@org.eclipse.jdt.core.tests.builder=GIT,tag=I20130314-1330,repo=git://git.eclipse.org/gitroot/jdt/eclipse.jdt.core.git,path=org.eclipse.jdt.core.tests.builder

+plugin@org.eclipse.jdt.debug.tests=GIT,tag=I20130314-1330,repo=git://git.eclipse.org/gitroot/jdt/eclipse.jdt.debug.git,path=org.eclipse.jdt.debug.tests

+plugin@org.eclipse.jdt.ui.tests=GIT,tag=I20130314-1330,repo=git://git.eclipse.org/gitroot/jdt/eclipse.jdt.ui.git,path=org.eclipse.jdt.ui.tests

+plugin@org.eclipse.jdt.ui.tests.refactoring=GIT,tag=I20130314-1330,repo=git://git.eclipse.org/gitroot/jdt/eclipse.jdt.ui.git,path=org.eclipse.jdt.ui.tests.refactoring

+plugin@org.eclipse.jdt.text.tests=GIT,tag=I20130314-1330,repo=git://git.eclipse.org/gitroot/jdt/eclipse.jdt.ui.git,path=org.eclipse.jdt.text.tests

+plugin@org.eclipse.jface.text.tests=GIT,tag=I20130314-1330,repo=git://git.eclipse.org/gitroot/platform/eclipse.platform.text.git,path=org.eclipse.jface.text.tests

+plugin@org.eclipse.text.tests=GIT,tag=I20130314-1330,repo=git://git.eclipse.org/gitroot/platform/eclipse.platform.text.git,path=org.eclipse.text.tests

+plugin@org.eclipse.core.filebuffers.tests=GIT,tag=I20130314-1330,repo=git://git.eclipse.org/gitroot/platform/eclipse.platform.text.git,path=org.eclipse.core.filebuffers.tests

diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/model/org/eclipse/objectteams/otdt/tests/otmodel/OTReconcilerTests.java b/testplugins/org.eclipse.objectteams.otdt.tests/model/org/eclipse/objectteams/otdt/tests/otmodel/OTReconcilerTests.java
index 6d2993c..a17f5ec 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/model/org/eclipse/objectteams/otdt/tests/otmodel/OTReconcilerTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/model/org/eclipse/objectteams/otdt/tests/otmodel/OTReconcilerTests.java
@@ -1631,4 +1631,69 @@
     		deleteProject("P");
     	}
     }
+
+    // Bug 400360 - [reconciler] fails to resolve callout-to-field with path-anchored type
+    public void testBug400360() throws CoreException, InterruptedException {
+    	try {
+			// Resources creation
+			IJavaProject p = createOTJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "bin");
+			IProject project = p.getProject();
+			IProjectDescription prjDesc = project.getDescription();
+			prjDesc.setBuildSpec(OTDTPlugin.createProjectBuildCommands(prjDesc));
+			project.setDescription(prjDesc, null);
+			p.setOption(JavaCore.COMPILER_PB_UNUSED_LOCAL, JavaCore.IGNORE);
+	
+			OTREContainer.initializeOTJProject(project);
+
+			String allShapesSourceString =	
+					"public team class AllShapes {\n" + 
+		    		"\n" + 
+		    		"	public abstract class Connector { }\n" + 
+		    		"	public abstract class RectangularConnector extends Connector { }\n" + 
+		    		"}\n";
+			this.createFile(
+				"/P/AllShapes.java",
+				allShapesSourceString);
+			
+			String chdSourceString =	
+					"public team class CompanyHierarchyDisplay {\n" + 
+		    		"    \n" + 
+		    		"	public final AllShapes _shapes = new AllShapes();\n" + 
+		    		"	\n" + 
+		    		"    public class Connection {\n" + 
+		    		"    	Connector<@_shapes> connShape;\n" + 
+		    		"    }\n" + 
+		    		"}\n";
+			this.createFile(
+				"/P/CompanyHierarchyDisplay.java",
+    			chdSourceString);
+			
+			String versionASourceString =	
+					"public team class VersionA {\n" + 
+		    		"    private final CompanyHierarchyDisplay _chd;\n" + 
+		    		"    \n" + 
+		    		"    public VersionA(CompanyHierarchyDisplay chd) {\n" + 
+		    		"    	_chd = chd;\n" + 
+		    		"    }\n" + 
+		    		"    \n" + 
+		    		"    public class RectangularConnections playedBy Connection<@_chd> {\n" + 
+		    		"       final AllShapes _shapesX = _chd._shapes;\n" +
+		    		"       @SuppressWarnings(\"decapsulation\")\n" + 
+		    		"		void setShape(RectangularConnector<@_shapesX> shape) -> set Connector<@_chd._shapes> connShape;\n" + 
+		    		"    }\n" + 
+		    		"}\n";
+			this.createFile(
+				"/P/VersionA.java",
+				versionASourceString);
+
+			char[] versionASourceChars = versionASourceString.toCharArray();
+			this.problemRequestor.initialize(versionASourceChars);
+			
+			ICompilationUnit unit = getCompilationUnit("/P/VersionA.java").getWorkingCopy(this.wcOwner, null);
+			
+			assertNoProblem(versionASourceChars, unit);
+    	} finally {
+    		deleteProject("P");
+    	}    	
+    }
 }
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/roleplaying/LiftingAndLowering.java b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/roleplaying/LiftingAndLowering.java
index d323f10..4bbe522 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/roleplaying/LiftingAndLowering.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/roleplaying/LiftingAndLowering.java
@@ -5495,4 +5495,53 @@
     		"----------\n");
     }
 
+    // [compiler] resolve error re lifting constructor with implicit playedBy refinement
+    public void testBug400833() {
+    	runConformTest(
+    		new String[] {
+    			"to/TOuter.java",
+    			"package to;\n" + 
+    			"\n" + 
+    			"\n" + 
+    			"import base tb.TB1;\n" + 
+    			"import base tb.TB2;\n" + 
+    			"\n" + 
+    			"public team class TOuter {\n" + 
+    			"	public team class T1 playedBy TB1 {\n" + 
+    			"		protected class R playedBy B<@base> { }\n" + 
+    			"		/* added method */\n" + 
+    			"		public void test() {\n" + 
+    			"			new R(new B<@base>()); // works!\n" + 
+    			"		}\n" + 
+    			"	}\n" + 
+    			"	public team class T2 extends T1  playedBy TB2 {\n" + 
+    			"		@Override\n" +
+    			"		protected class R playedBy B<@base> { }\n" + 
+    			"		@Override\n" + 
+    			"		public void test() {\n" + 
+    			"			new R(new B<@base>());  // error!\n" + 
+    			"		}\n" + 
+    			"	}\n" +
+    			"	void test(TB2 as T2 t2) {\n" +
+    			"		t2.test();\n" +
+    			"	}\n" +
+    			"	public static void main(String... args) {\n" +
+    			"		new TOuter().test(new tb.TB2());\n" +
+    			"	}\n" + 
+    			"}\n",
+    			"tb/TB2.java",
+    			"package tb;\n" +
+    			"public team class TB2 extends TB1 {\n" +
+    			"	@Override public class B {\n" +
+    			"		public B() { System.out.print(\"OK\"); }\n" +
+    			"	}\n" +
+    			"}\n",
+    			"tb/TB1.java",
+    			"package tb;\n" +
+    			"public team class TB1 {\n" +
+    			"	public class B {}\n" +
+    			"}\n",
+    		},
+    		"OK");
+    }
 }
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/ExternalizedRoles.java b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/ExternalizedRoles.java
index c0ab42f..0d2a536 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/ExternalizedRoles.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/ExternalizedRoles.java
@@ -1518,92 +1518,87 @@
 			    "        \n"
             },
     		"----------\n" +
-			"1. ERROR in Team167ratb5f_2.java (at line 3)\n" +
-			"	public class R playedBy Team167ratb5f_1 {\n" +
-			"	             ^\n" +
-			"The type R must be an abstract class to define abstract methods\n" +
-			"----------\n" +
-			"2. ERROR in Team167ratb5f_2.java (at line 8)\n" +
+			"1. ERROR in Team167ratb5f_2.java (at line 8)\n" +
 			"	R<@base> r = getR2(getR1());\n" +
 			"	^\n" +
 			"Illegal use of value parameter: type Team167ratb5f_2.R does not declare a value parameter at position 1 (OTJLD 9.2.1).\n" +
 			"----------\n" +
-			"3. ERROR in Team167ratb5f_2.java (at line 8)\n" +
+			"2. ERROR in Team167ratb5f_2.java (at line 8)\n" +
 			"	R<@base> r = getR2(getR1());\n" +
 			"	             ^^^^^\n" +
 			"The method getR2(R<@tthis[Team167ratb5f_2]>) in the type Team167ratb5f_2.R is not applicable for the arguments (R)\n" +
 			"----------\n" +
-			"4. ERROR in Team167ratb5f_2.java (at line 9)\n" +
+			"3. ERROR in Team167ratb5f_2.java (at line 9)\n" +
 			"	r.test();\n" +
 			"	^\n" +
 			"The type R is not visible\n" +
 			"----------\n" +
-			"5. ERROR in Team167ratb5f_2.java (at line 11)\n" +
+			"4. ERROR in Team167ratb5f_2.java (at line 11)\n" +
 			"	abstract R<@base> getR1();\n" +
 			"	         ^\n" +
 			"Illegal use of value parameter: type Team167ratb5f_2.R does not declare a value parameter at position 1 (OTJLD 9.2.1).\n" +
 			"----------\n" +
-			"6. ERROR in Team167ratb5f_2.java (at line 11)\n" +
+			"5. ERROR in Team167ratb5f_2.java (at line 11)\n" +
 			"	abstract R<@base> getR1();\n" +
 			"	         ^^^^^^^^\n" +
 			"The return type is incompatible with Team167ratb5f_2.R.getR1()\n" +
 			"----------\n" +
-			"7. ERROR in Team167ratb5f_2.java (at line 12)\n" +
+			"6. ERROR in Team167ratb5f_2.java (at line 12)\n" +
 			"	R<@base> getR1() -> R<@base> getR1();\n" +
 			"	^\n" +
 			"Illegal use of value parameter: type Team167ratb5f_2.R does not declare a value parameter at position 1 (OTJLD 9.2.1).\n" +
 			"----------\n" +
-			"8. ERROR in Team167ratb5f_2.java (at line 12)\n" +
+			"7. ERROR in Team167ratb5f_2.java (at line 12)\n" +
 			"	R<@base> getR1() -> R<@base> getR1();\n" +
 			"	^\n" +
 			"Method designator binds to a method returning R whereas return type R is specified (OTJLD 3.1(c)).\n" +
 			"----------\n" +
-			"9. ERROR in Team167ratb5f_2.java (at line 12)\n" +
+			"8. ERROR in Team167ratb5f_2.java (at line 12)\n" +
 			"	R<@base> getR1() -> R<@base> getR1();\n" +
 			"	                    ^\n" +
 			"Illegal use of value parameter: type Team167ratb5f_2.R does not declare a value parameter at position 1 (OTJLD 9.2.1).\n" +
 			"----------\n" +
-			"10. ERROR in Team167ratb5f_2.java (at line 12)\n" +
+			"9. ERROR in Team167ratb5f_2.java (at line 12)\n" +
 			"	R<@base> getR1() -> R<@base> getR1();\n" +
 			"	                    ^\n" +
 			"Method designator binds to a method returning R1<@tthis[Team167ratb5f_1]> whereas return type R is specified (OTJLD 3.1(c)).\n" +
 			"----------\n" +
-			"11. ERROR in Team167ratb5f_2.java (at line 13)\n" +
+			"10. ERROR in Team167ratb5f_2.java (at line 13)\n" +
 			"	abstract R<@base> getR2(R<@base> in);\n" +
 			"	         ^\n" +
 			"Illegal use of value parameter: type Team167ratb5f_2.R does not declare a value parameter at position 1 (OTJLD 9.2.1).\n" +
 			"----------\n" +
-			"12. ERROR in Team167ratb5f_2.java (at line 13)\n" +
+			"11. ERROR in Team167ratb5f_2.java (at line 13)\n" +
 			"	abstract R<@base> getR2(R<@base> in);\n" +
 			"	                  ^^^^^^^^^^^^^^^^^^\n" +
 			"The abstract method getR2 in type R can only be defined by an abstract class\n" +
 			"----------\n" +
-			"13. ERROR in Team167ratb5f_2.java (at line 13)\n" +
+			"12. ERROR in Team167ratb5f_2.java (at line 13)\n" +
 			"	abstract R<@base> getR2(R<@base> in);\n" +
 			"	                        ^\n" +
 			"Illegal use of value parameter: type Team167ratb5f_2.R does not declare a value parameter at position 1 (OTJLD 9.2.1).\n" +
 			"----------\n" +
-			"14. ERROR in Team167ratb5f_2.java (at line 14)\n" +
+			"13. ERROR in Team167ratb5f_2.java (at line 14)\n" +
 			"	R<@base> getR2(R<@base> in) -> R<@base> getR2(R<@base>1 in); // here\n" +
 			"	^\n" +
 			"Illegal use of value parameter: type Team167ratb5f_2.R does not declare a value parameter at position 1 (OTJLD 9.2.1).\n" +
 			"----------\n" +
-			"15. ERROR in Team167ratb5f_2.java (at line 14)\n" +
+			"14. ERROR in Team167ratb5f_2.java (at line 14)\n" +
 			"	R<@base> getR2(R<@base> in) -> R<@base> getR2(R<@base>1 in); // here\n" +
 			"	               ^\n" +
 			"Illegal use of value parameter: type Team167ratb5f_2.R does not declare a value parameter at position 1 (OTJLD 9.2.1).\n" +
 			"----------\n" +
-			"16. ERROR in Team167ratb5f_2.java (at line 14)\n" +
+			"15. ERROR in Team167ratb5f_2.java (at line 14)\n" +
 			"	R<@base> getR2(R<@base> in) -> R<@base> getR2(R<@base>1 in); // here\n" +
 			"	                               ^\n" +
 			"Illegal use of value parameter: type Team167ratb5f_2.R does not declare a value parameter at position 1 (OTJLD 9.2.1).\n" +
 			"----------\n" +
-			"17. ERROR in Team167ratb5f_2.java (at line 14)\n" +
+			"16. ERROR in Team167ratb5f_2.java (at line 14)\n" +
 			"	R<@base> getR2(R<@base> in) -> R<@base> getR2(R<@base>1 in); // here\n" +
 			"	                               ^^^^^^^^^^^^^^^\n" +
 			"No method getR2() found in type Team167ratb5f_1 to resolve method designator (OTJLD 3.1(c)).\n" +
 			"----------\n" +
-			"18. ERROR in Team167ratb5f_2.java (at line 14)\n" +
+			"17. ERROR in Team167ratb5f_2.java (at line 14)\n" +
 			"	R<@base> getR2(R<@base> in) -> R<@base> getR2(R<@base>1 in); // here\n" +
 			"	                                                      ^\n" +
 			"Syntax error on token \"1\", delete this token\n" +
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/ImplicitInheritance.java b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/ImplicitInheritance.java
index 863910c..17ce0bb 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/ImplicitInheritance.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/ImplicitInheritance.java
@@ -1369,4 +1369,30 @@
 			"----------\n");
     }
 
+    // Bug 400362 - [compiler] role field with anchored role type breaks implicit inheritance
+    public void test0c16_implicitInheritanceRegression2() {
+    	runConformTest(
+    		new String[]{
+    	"p2/SubTeam.java",
+    		"package p2;\n" +
+    		"import p1.SuperTeam;\n" +
+    		"public team class SubTeam extends SuperTeam {\n" +
+    		"	public abstract class R {}\n" +
+    		"}\n",
+    	"p1/SuperTeam.java",
+    		"package p1;\n" +
+    		"public team class SuperTeam {\n" +
+    		"	final OtherTeam other=new OtherTeam();\n" +
+    		"	public abstract class R {\n" +
+    		"		OR<@other> otherRole;\n" +
+    		"	}\n" +
+    		"}\n",
+    	"p1/OtherTeam.java",
+    		"package p1;\n" +
+    		"public team class OtherTeam {\n" +
+    		"	public abstract class OR {}\n" +
+    		"}\n"
+    		},
+    		"");
+    }
 }
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/RegularRoleInheritance.java b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/RegularRoleInheritance.java
index 4c49747..c3da608 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/RegularRoleInheritance.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/RegularRoleInheritance.java
@@ -34,7 +34,7 @@
 	// Static initializer to specify tests subset using TESTS_* static variables
 	// All specified tests which does not belong to the class are skipped...
 	static {
-//		TESTS_NAMES = new String[] { "test148_extendingRoleFromUnrelatedTeam2" };
+//		TESTS_NAMES = new String[] { "testBug403396_2" };
 //		TESTS_NUMBERS = new int[] { 1459 };
 //		TESTS_RANGE = new int[] { 1097, -1 };
 	}
@@ -1489,4 +1489,57 @@
             },
             "cannot be resolved");
     }
+
+    public void testBug403396_1() {
+    	runConformTest(
+    		new String[] {
+    			"base/BGraph.java",
+    			"package base;\n" + 
+    			"\n" + 
+    			"public team class BGraph {\n" + 
+    			"	public class BNode { }\n" + 
+    			"	public class BEdge {}\n" + 
+    			"}\n",
+    			"features/Features.java",
+    			"package features;\n" + 
+    			"import base base.BGraph;\n" + 
+    			"public team class Features {\n" + 
+    			"	public team class BasicGraph playedBy BGraph {\n" + 
+    			"		public BasicGraph() { base(); }\n" + 
+    			"		public class Edge playedBy BEdge<@base> {\n" + 
+    			"			public Edge() { base(); }\n" + 
+    			"		}\n" + 
+    			"	}\n" + 
+    			"	public team class WeightedGraph extends BasicGraph {\n" + 
+    			"	}\n" + 
+    			"}\n"
+    		});
+    }
+
+    public void testBug403396_2() {
+    	runConformTest(
+    		new String[] {
+    			"base/BGraph.java",
+    			"package base;\n" + 
+    			"\n" + 
+    			"public team class BGraph {\n" + 
+    			"	public class BNode { }\n" + 
+    			"	public class BEdge {}\n" + 
+    			"}\n",
+    			"features/Features.java",
+    			"package features;\n" + 
+    			"import base base.BGraph;\n" + 
+    			"public team class Features {\n" + 
+    			"	public team class BasicGraph playedBy BGraph {\n" + 
+    			"		public BasicGraph() { base(); }\n" + 
+    			"		public class Edge playedBy BEdge<@base> {\n" + 
+    			"			public Edge() { base(); }\n" + 
+    			"		}\n" + 
+    			"	}\n" + 
+    			"	public team class WeightedGraph extends BasicGraph {\n" +
+    			"		@Override public class Edge {}\n" + 
+    			"	}\n" + 
+    			"}\n"
+    		});
+    }
 }
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/TeamNesting.java b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/TeamNesting.java
index ec1d96f..a719ed2 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/TeamNesting.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/TeamNesting.java
@@ -1,13 +1,12 @@
 /**********************************************************************
  * This file is part of "Object Teams Development Tooling"-Software
  * 
- * Copyright 2010 Stephan Herrmann
+ * Copyright 2010, 2013 Stephan Herrmann
  * 
  * 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
  * http://www.eclipse.org/legal/epl-v10.html
- * $Id$
  * 
  * Please visit http://www.eclipse.org/objectteams for updates and contact.
  * 
@@ -2253,6 +2252,53 @@
     		"OK");
     }
 
+    // Bug 400404 - [compiler] No enclosing instance of the type TOuter.T1 is accessible in scope - layered team and inheritance
+    public void test1122_layerdTeams9() {
+       runConformTest(
+            new String[] {
+		"Team1122lt9_2.java",
+			    "\n" +
+			    "public team class Team1122lt9_2 {\n" +
+			    "  public team class T1 {\n" + 
+			    "    protected final Team1122lt9_1 thatTeam = new Team1122lt9_1();\n" + 
+			    "    protected class R playedBy R1<@thatTeam> {" +
+			    "      @SuppressWarnings(\"basecall\")\n" +
+			    "      callin String fixedToString() {\n" +
+			    "        return \"OK\";\n" +
+			    "      }\n" +
+			    "    }\n" + 
+			    "  }\n" +
+			    "  public team class T2 extends T1 {\n" +
+			    "    @Override protected class R {\n" + 
+			    "      String fixedToString() <- replace String toString();\n" +
+			    "    }\n" +
+			    "  }\n" +
+			    "  void test() {\n" +
+			    "    T2 t = new T2();\n" +
+			    "    t.activate();\n" +
+			    "    System.out.print(t.thatTeam.getR1(\"NOTOK\"));\n" +
+			    "  }\n" +
+			    "  public static void main(String[] args) {\n" +
+			    "    new Team1122lt9_2().test();\n" +
+			    "  }\n" +
+			    "}\n" +
+			    "  \n",
+		"Team1122lt9_1.java",
+			    "\n" +
+			    "public team class Team1122lt9_1 {\n" +
+			    "  public class R1 {\n" +
+			    "    String val;\n" +
+			    "    public R1(String v) { this.val = v; }\n" +
+			    "    @Override\n" +
+			    "    public String toString() { return val; }\n" +
+			    "  }\n" +
+			    "  public R1 getR1(String v) { return new R1(v); }\n" +
+			    "}\n" +
+			    "  \n"
+            },
+            "OK");
+    }
+
     // a nested team is played by a regular class, its (inner) role by an inner of the base - (we had a problem with splitting creation methods in conjunction with base class decapsulation )
     // 1.1.23-otjld-team-layered-on-regular-nested-1
     public void test1123_teamLayeredOnRegularNested1() {
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.dom/src/org/eclipse/objectteams/otdt/ui/tests/dom/rewrite/describing/CallinMappingDeclarationTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.dom/src/org/eclipse/objectteams/otdt/ui/tests/dom/rewrite/describing/CallinMappingDeclarationTest.java
index ff834a0..9270c04 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.dom/src/org/eclipse/objectteams/otdt/ui/tests/dom/rewrite/describing/CallinMappingDeclarationTest.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.dom/src/org/eclipse/objectteams/otdt/ui/tests/dom/rewrite/describing/CallinMappingDeclarationTest.java
@@ -70,7 +70,7 @@
 		buf.append("}\n");	
 		ICompilationUnit cu= pack1.createCompilationUnit("T.java", buf.toString(), false, null);	
 		
-		CompilationUnit astRoot= createAST3(cu);
+		CompilationUnit astRoot= createAST(cu);
 		ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
 		AST ast= astRoot.getAST();
 		RoleTypeDeclaration type= findRoleTypeDeclaration(findTypeDeclaration(astRoot, "T"), "E");
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.dom/src/org/eclipse/objectteams/otdt/ui/tests/dom/rewrite/describing/TypeDeclarationTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.dom/src/org/eclipse/objectteams/otdt/ui/tests/dom/rewrite/describing/TypeDeclarationTest.java
index 0c9acb5..d348718 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.dom/src/org/eclipse/objectteams/otdt/ui/tests/dom/rewrite/describing/TypeDeclarationTest.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.dom/src/org/eclipse/objectteams/otdt/ui/tests/dom/rewrite/describing/TypeDeclarationTest.java
@@ -69,7 +69,7 @@
 		buf.append("}\n");
 		ICompilationUnit cu= pack1.createCompilationUnit("T.java", buf.toString(), false, null);			
 
-		CompilationUnit astRoot= createAST3(cu);
+		CompilationUnit astRoot= createAST(cu);
 		ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
 		AST ast= astRoot.getAST();
 		
@@ -129,7 +129,7 @@
 		buf.append("}\n");
 		ICompilationUnit cu= pack1.createCompilationUnit("T.java", buf.toString(), false, null);			
 
-		CompilationUnit astRoot= createAST3(cu);
+		CompilationUnit astRoot= createAST(cu);
 		ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
 		AST ast= astRoot.getAST();
 		
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/OTSubHierarchyContentProviderTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/OTSubHierarchyContentProviderTests.java
index 04feb41..cee09fc 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/OTSubHierarchyContentProviderTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/OTSubHierarchyContentProviderTests.java
@@ -61,7 +61,7 @@
     private IType _T8;
     
 	private IType _T1_R1;
-	private IType _T1_R2;
+	// private IType _T1_R2; not within the cone of types reachable from _T1_R1
 	
 	private IType _T2_R1;
 	private IType _T2_R2;
@@ -175,14 +175,7 @@
 					pkg,
 					"T1",
 			        "R1").getCorrespondingJavaElement();
-		
-		_T1_R2 = (IType)
-			getRole(getTestProjectDir(),
-					SRC_FOLDER,
-					pkg,
-					"T1",
-			        "R2").getCorrespondingJavaElement();
-		
+
 		_T2_R1 = (IType)
 			getRole(getTestProjectDir(),
 					SRC_FOLDER,
@@ -272,7 +265,7 @@
 		_allTypesInProject = new IType[]
 		                              {
 		        _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8,
-		        _T1_R1, _T1_R2, 
+		        _T1_R1, //_T1_R2, 
 		        _T2_R1, _T2_R2,
 		        _T3_R1, _T3_R2,
 		        _T4_R2,
@@ -310,6 +303,7 @@
         for (int idx = 0; idx < _allTypesInProject.length; idx++)
         {
             IType cur = _allTypesInProject[idx];
+            if (cur == _T2_R2) continue; // skip, cur's parent is outside the visible cone
 	        actual = _testObject.getParent(cur);
 	        assertEquals("Unexpected parent for " + cur.getFullyQualifiedName() + " ", parents.get(cur), actual);
         }
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/TreeNode.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/TreeNode.java
index 5104585..68d2a43 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/TreeNode.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/TreeNode.java
@@ -21,7 +21,9 @@
 package org.eclipse.objectteams.otdt.ui.tests.hierarchy.contentprovider;
 
 import java.util.HashMap;
+import java.util.Map.Entry;
 
+import org.eclipse.jdt.core.IJavaElement;
 import org.eclipse.jdt.core.IType;
 import org.eclipse.objectteams.otdt.tests.FileBasedTest;
 
@@ -141,4 +143,19 @@
 		this._children.put(node.getElement(), node);
 		
 	}
+
+	// facilitate debugging:
+	public String toString() {
+		StringBuffer buf = new StringBuffer();
+		toString(buf, 0);
+		return buf.toString();
+	}
+
+	private void toString(StringBuffer buf, int indent) {
+		for (int i=0; i<indent; i++) buf.append(' ');
+		IJavaElement element = (IJavaElement)this._element;
+		buf.append(element.getParent().getElementName()).append('.').append(element.getElementName()).append('\n');
+		for (Entry<Object,TreeNode> e : this._children.entrySet())
+			e.getValue().toString(buf, 4);
+	}
 }
\ No newline at end of file