diff --git a/framework/tests/all-systems/Issue6856.java b/framework/tests/all-systems/Issue6856.java new file mode 100644 index 00000000000..4d68fe83364 --- /dev/null +++ b/framework/tests/all-systems/Issue6856.java @@ -0,0 +1,7 @@ +import java.util.Collections; + +public class Issue6856 { + static void test(Class p) { + var x = Collections.checkedCollection((Collections.emptyList()), p); + } +} diff --git a/javacutil/src/main/java/org/checkerframework/javacutil/TreeUtils.java b/javacutil/src/main/java/org/checkerframework/javacutil/TreeUtils.java index 93dc1ae9041..3bf5d053d36 100644 --- a/javacutil/src/main/java/org/checkerframework/javacutil/TreeUtils.java +++ b/javacutil/src/main/java/org/checkerframework/javacutil/TreeUtils.java @@ -2849,6 +2849,7 @@ public static boolean isPolyExpression(ExpressionTree expression) { * @return whether or not {@code expression} is a standalone expression */ public static boolean isStandaloneExpression(ExpressionTree expression) { + expression = TreeUtils.withoutParens(expression); if (expression instanceof JCTree.JCExpression) { if (((JCTree.JCExpression) expression).isStandalone()) { return true;