@@ -2919,7 +2919,7 @@ Symbol resolveDiamond(DiagnosticPosition pos,
2919
2919
new BasicLookupHelper (names .init , site , argtypes , typeargtypes ) {
2920
2920
@ Override
2921
2921
Symbol doLookup (Env <AttrContext > env , MethodResolutionPhase phase ) {
2922
- return findDiamond (env , site , argtypes , typeargtypes ,
2922
+ return findDiamond (pos , env , site , argtypes , typeargtypes ,
2923
2923
phase .isBoxingRequired (),
2924
2924
phase .isVarargsRequired ());
2925
2925
}
@@ -2942,6 +2942,29 @@ Symbol access(Env<AttrContext> env, DiagnosticPosition pos, Symbol location, Sym
2942
2942
}});
2943
2943
}
2944
2944
2945
+ /** Find the constructor using diamond inference and do some checks(deprecated and preview).
2946
+ * @param pos The position to use for error reporting.
2947
+ * @param env The environment current at the constructor invocation.
2948
+ * @param site The type of class for which a constructor is searched.
2949
+ * The scope of this class has been touched in attribution.
2950
+ * @param argtypes The types of the constructor invocation's value arguments.
2951
+ * @param typeargtypes The types of the constructor invocation's type arguments.
2952
+ * @param allowBoxing Allow boxing conversions of arguments.
2953
+ * @param useVarargs Box trailing arguments into an array for varargs.
2954
+ */
2955
+ private Symbol findDiamond (DiagnosticPosition pos ,
2956
+ Env <AttrContext > env ,
2957
+ Type site ,
2958
+ List <Type > argtypes ,
2959
+ List <Type > typeargtypes ,
2960
+ boolean allowBoxing ,
2961
+ boolean useVarargs ) {
2962
+ Symbol sym = findDiamond (env , site , argtypes , typeargtypes , allowBoxing , useVarargs );
2963
+ chk .checkDeprecated (pos , env .info .scope .owner , sym );
2964
+ chk .checkPreview (pos , sym );
2965
+ return sym ;
2966
+ }
2967
+
2945
2968
/** This method scans all the constructor symbol in a given class scope -
2946
2969
* assuming that the original scope contains a constructor of the kind:
2947
2970
* {@code Foo(X x, Y y)}, where X,Y are class type-variables declared in Foo,
0 commit comments