changeset 47299:45605dc2880c lvti

Fix: jshell VariablesTest is failing after 8044853 Fix: some files include trailing whitespaces Fix: jshell tests miss references to bug id 8177466
author mcimadamore
date Tue, 26 Sep 2017 13:11:35 +0100
parents a5dcf182e432
children 06793e20e62a
files src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java src/jdk.jshell/share/classes/jdk/jshell/ExpressionToTypeInfo.java test/langtools/jdk/jshell/CompletionSuggestionTest.java test/langtools/jdk/jshell/ToolSimpleTest.java test/langtools/jdk/jshell/VariablesTest.java test/langtools/tools/javac/lvti/FoldingTest.java test/langtools/tools/javac/lvti/SelfRefTest.java
diffstat 7 files changed, 15 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Mon Sep 25 18:09:44 2017 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Tue Sep 26 13:11:35 2017 +0100
@@ -208,7 +208,7 @@
                 return UPWARDS;
             }
         };
-        
+
         abstract ProjectionKind complement();
     }
 
--- a/src/jdk.jshell/share/classes/jdk/jshell/ExpressionToTypeInfo.java	Mon Sep 25 18:09:44 2017 +0200
+++ b/src/jdk.jshell/share/classes/jdk/jshell/ExpressionToTypeInfo.java	Tue Sep 26 13:11:35 2017 +0100
@@ -130,7 +130,7 @@
                 return null;
             }
         }
-        
+
     }
 
     private Type pathToType(TreePath tp) {
@@ -259,8 +259,8 @@
                                                       .stream()
                                                       .map(t -> varTypeName(t, false))
                                                       .collect(List.collector());
-                        if (getEnclosingExpression(nct) != null) {
-                            TreePath enclPath = new TreePath(tp, getEnclosingExpression(nct));
+                        if (nct.getEnclosingExpression() != null) {
+                            TreePath enclPath = new TreePath(tp, nct.getEnclosingExpression());
                             ei.enclosingInstanceType = varTypeName(pathToType(enclPath), false);
                         }
                         ei.isClass = at.task.getTypes().directSupertypes(type).size() == 1;
@@ -288,25 +288,4 @@
         }
     }
 
-    private static ExpressionTree getEnclosingExpression(NewClassTree nct) {
-        //workaround for: JDK-8044853, invocations should be replaced with nct.getEnclosingExpression():
-        if (nct.getArguments().size() > 0) {
-            com.sun.tools.javac.tree.JCTree arg = (com.sun.tools.javac.tree.JCTree) nct.getArguments().get(0);
-            if (arg.hasTag(com.sun.tools.javac.tree.JCTree.Tag.NULLCHK)) {
-                return ((com.sun.tools.javac.tree.JCTree.JCUnary) arg).arg;
-            } else {
-                ClassTree clazz = nct.getClassBody();
-                MethodTree constructor = (MethodTree) clazz.getMembers().get(0);
-                ExpressionStatementTree superCallStatement =
-                        (ExpressionStatementTree) constructor.getBody().getStatements().get(0);
-                MethodInvocationTree superCall =
-                        (MethodInvocationTree) superCallStatement.getExpression();
-                if (superCall.getMethodSelect().getKind() == Kind.MEMBER_SELECT) {
-                    return (ExpressionTree) arg;
-                }
-            }
-        }
-        return null;
-    }
-
 }
--- a/test/langtools/jdk/jshell/CompletionSuggestionTest.java	Mon Sep 25 18:09:44 2017 +0200
+++ b/test/langtools/jdk/jshell/CompletionSuggestionTest.java	Tue Sep 26 13:11:35 2017 +0100
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8131025 8141092 8153761 8145263 8131019 8175886 8176184 8176241 8176110
+ * @bug 8131025 8141092 8153761 8145263 8131019 8175886 8176184 8176241 8176110 8177466
  * @summary Test Completion and Documentation
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
--- a/test/langtools/jdk/jshell/ToolSimpleTest.java	Mon Sep 25 18:09:44 2017 +0200
+++ b/test/langtools/jdk/jshell/ToolSimpleTest.java	Tue Sep 26 13:11:35 2017 +0100
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897 8167128 8154513 8170015 8170368 8172102 8172103  8165405 8173073 8173848 8174041 8173916 8174028 8174262 8174797 8177079 8180508
+ * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897 8167128 8154513 8170015 8170368 8172102 8172103  8165405 8173073 8173848 8174041 8173916 8174028 8174262 8174797 8177079 8180508 8177466
  * @summary Simple jshell tool tests
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
--- a/test/langtools/jdk/jshell/VariablesTest.java	Mon Sep 25 18:09:44 2017 +0200
+++ b/test/langtools/jdk/jshell/VariablesTest.java	Tue Sep 26 13:11:35 2017 +0100
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8144903
+ * @bug 8144903 8177466
  * @summary Tests for EvaluationState.variables
  * @build KullaTesting TestingInputStream ExpectedDiagnostic
  * @run testng VariablesTest
--- a/test/langtools/tools/javac/lvti/FoldingTest.java	Mon Sep 25 18:09:44 2017 +0200
+++ b/test/langtools/tools/javac/lvti/FoldingTest.java	Tue Sep 26 13:11:35 2017 +0100
@@ -6,12 +6,12 @@
  */
 class FoldingTest {
 
-	void testReachability() {
-    	for(var i = 0; i < 3; i++) {
-	      // ok
-    	}
-	    System.out.println("foo");   //this should be reachable
-	}
+        void testReachability() {
+        for(var i = 0; i < 3; i++) {
+              // ok
+        }
+            System.out.println("foo");   //this should be reachable
+        }
 
     void testCase(String s) {
         var c = "";
--- a/test/langtools/tools/javac/lvti/SelfRefTest.java	Mon Sep 25 18:09:44 2017 +0200
+++ b/test/langtools/tools/javac/lvti/SelfRefTest.java	Tue Sep 26 13:11:35 2017 +0100
@@ -9,13 +9,13 @@
 
 class SelfRefTest {
 
-	int q() { return 42; }
+        int q() { return 42; }
     int m(int t) { return t; }
 
     void test(boolean cond) {
        var x = cond ? x : x; //error - self reference
        var y = (Function<Integer, Integer>)(Integer y) -> y; //error - bad shadowing
-       var z = (Runnable)() -> { int z2 = m(z); }; //error - self reference       
+       var z = (Runnable)() -> { int z2 = m(z); }; //error - self reference
        var w = new Object() { int w = 42; void test() { int w2 = w; } }; //ok
        int u = u; //ok
        int q = q(); //ok