langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/StringConcat.java
changeset 42828 cce89649f958
parent 39920 4923274643f2
equal deleted inserted replaced
42827:36468b5fa7f4 42828:cce89649f958
   222 
   222 
   223         private JCDiagnostic.DiagnosticPosition newStringBuilder(JCTree tree) {
   223         private JCDiagnostic.DiagnosticPosition newStringBuilder(JCTree tree) {
   224             JCDiagnostic.DiagnosticPosition pos = tree.pos();
   224             JCDiagnostic.DiagnosticPosition pos = tree.pos();
   225             gen.getCode().emitop2(new_, gen.makeRef(pos, syms.stringBuilderType));
   225             gen.getCode().emitop2(new_, gen.makeRef(pos, syms.stringBuilderType));
   226             gen.getCode().emitop0(dup);
   226             gen.getCode().emitop0(dup);
   227             gen.callMethod(pos, syms.stringBuilderType, names.init, List.<Type>nil(), false);
   227             gen.callMethod(pos, syms.stringBuilderType, names.init, List.nil(), false);
   228             return pos;
   228             return pos;
   229         }
   229         }
   230 
   230 
   231         private void appendString(JCTree tree) {
   231         private void appendString(JCTree tree) {
   232             Type t = tree.type.baseType();
   232             Type t = tree.type.baseType();
   243 
   243 
   244             gen.getItems().makeMemberItem(method, false).invoke();
   244             gen.getItems().makeMemberItem(method, false).invoke();
   245         }
   245         }
   246 
   246 
   247         private void builderToString(JCDiagnostic.DiagnosticPosition pos) {
   247         private void builderToString(JCDiagnostic.DiagnosticPosition pos) {
   248             gen.callMethod(pos, syms.stringBuilderType, names.toString, List.<Type>nil(), false);
   248             gen.callMethod(pos, syms.stringBuilderType, names.toString, List.nil(), false);
   249         }
   249         }
   250     }
   250     }
   251 
   251 
   252     /**
   252     /**
   253      * Base class for indified concatenation bytecode flavors.
   253      * Base class for indified concatenation bytecode flavors.
   351 
   351 
   352         /** Produce the actual invokedynamic call to StringConcatFactory */
   352         /** Produce the actual invokedynamic call to StringConcatFactory */
   353         private void doCall(Type type, JCDiagnostic.DiagnosticPosition pos, List<Type> dynamicArgTypes) {
   353         private void doCall(Type type, JCDiagnostic.DiagnosticPosition pos, List<Type> dynamicArgTypes) {
   354             Type.MethodType indyType = new Type.MethodType(dynamicArgTypes,
   354             Type.MethodType indyType = new Type.MethodType(dynamicArgTypes,
   355                     type,
   355                     type,
   356                     List.<Type>nil(),
   356                     List.nil(),
   357                     syms.methodClass);
   357                     syms.methodClass);
   358 
   358 
   359             int prevPos = make.pos;
   359             int prevPos = make.pos;
   360             try {
   360             try {
   361                 make.at(pos);
   361                 make.at(pos);
   455 
   455 
   456         /** Produce the actual invokedynamic call to StringConcatFactory */
   456         /** Produce the actual invokedynamic call to StringConcatFactory */
   457         private void doCall(Type type, JCDiagnostic.DiagnosticPosition pos, String recipe, List<Object> staticArgs, List<Type> dynamicArgTypes) {
   457         private void doCall(Type type, JCDiagnostic.DiagnosticPosition pos, String recipe, List<Object> staticArgs, List<Type> dynamicArgTypes) {
   458             Type.MethodType indyType = new Type.MethodType(dynamicArgTypes,
   458             Type.MethodType indyType = new Type.MethodType(dynamicArgTypes,
   459                     type,
   459                     type,
   460                     List.<Type>nil(),
   460                     List.nil(),
   461                     syms.methodClass);
   461                     syms.methodClass);
   462 
   462 
   463             int prevPos = make.pos;
   463             int prevPos = make.pos;
   464             try {
   464             try {
   465                 make.at(pos);
   465                 make.at(pos);