Community
Participate
Working Groups
This part of the file: String genMethodFindContext() { ''' public Iterable<EObject> findContexts(EObject obj, Iterable<EObject> contextCandidates) { «var pkgi = 0» «FOR pkg:accessedPackages /* ITERATOR i */» «IF (pkgi = pkgi + 1) > 1 /* !i.firstIteration */»else «ENDIF»if(obj.eClass().getEPackage() == «pkg.genPackage.packageInterfaceName».eINSTANCE) switch(obj.eClass().getClassifierID()) { «val width = pkg.accessedClasses.fold(0, [type, max | Math::max(type.genIntLiteral.length, max)])» «FOR type:pkg.accessedClasses» case «type.genIntLiteral»:«{type.genIntLiteral.length..width}.fold("",[i,s|s + " "])»return «IF type.accessedContexts.size == 1»singleton((EObject)grammarAccess.«type.accessedContexts.iterator.next.gaAccessor()»)«ELSE»findContexts((«type.getGenClass().interfaceName»)obj)«ENDIF»; «ENDFOR» } «ENDFOR» return Collections.emptyList(); } «FOR type:accessedClasses.filter(e|e.accessedContexts.size > 1)» «ENDFOR» '''.toString } compiles to: public String genMethodFindContext() { StringConcatenation _builder = new StringConcatenation(); _builder.append("public Iterable<EObject> findContexts(EObject obj, Iterable<EObject> contextCandidates) {"); _builder.newLine(); _builder.append("\t"); int pkgi = 0; _builder.newLineIfNotEmpty(); { Iterable<EPackage> _accessedPackages = this.getAccessedPackages(); for(EPackage pkg : _accessedPackages) { _builder.append("\t"); { final int typeConverted_pkgi = (int)pkgi; int _operator_plus = IntegerExtensions.operator_plus(((Integer)typeConverted_pkgi), ((Number)1)); int _pkgi = pkgi = _operator_plus; boolean _operator_greaterThan = ComparableExtensions.<Integer>operator_greaterThan(((Comparable<? super Integer>)_pkgi), 1); if (_operator_greaterThan) { _builder.append("else "); } } _builder.append("if(obj.eClass().getEPackage() == "); GenPackage _genPackage = GenModelAccess.getGenPackage(pkg); String _packageInterfaceName = _genPackage.getPackageInterfaceName(); _builder.append(_packageInterfaceName, " "); _builder.append(".eINSTANCE) switch(obj.eClass().getClassifierID()) {"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("\t"); Iterable<EClass> _accessedClasses = this.getAccessedClasses(pkg); final Function2<EClass,? super Integer,Integer> _function = new Function2<EClass,? super Integer,Integer>() { public Integer apply(EClass type , Integer max) { final EClass typeConverted_type = (EClass)type; String _genIntLiteral = GenModelAccess.getGenIntLiteral(typeConverted_type); int _length = _genIntLiteral.length(); final Integer typeConverted_max = (Integer)max; int _max = Math.max(_length, typeConverted_max); return ((Integer)_max); } }; Integer _fold = IterableExtensions.<EClass, Integer>fold(_accessedClasses, ((Integer)0), _function); final Integer width = _fold; _builder.newLineIfNotEmpty(); { Iterable<EClass> _accessedClasses_1 = this.getAccessedClasses(pkg); for(EClass type_1 : _accessedClasses_1) { _builder.append("\t"); _builder.append("\t"); _builder.append("case "); final EClass typeConverted_type_1 = (EClass)type_1; String _genIntLiteral_1 = GenModelAccess.getGenIntLiteral(typeConverted_type_1); _builder.append(_genIntLiteral_1, " "); _builder.append(":"); final EClass typeConverted_type_1_1 = (EClass)type_1; String _genIntLiteral_2 = GenModelAccess.getGenIntLiteral(typeConverted_type_1_1); int _length_1 = _genIntLiteral_2.length(); final Integer typeConverted_width = (Integer)width; Iterable<Integer> _operator_upTo = IntegerExtensions.operator_upTo(((Integer)_length_1), typeConverted_width); final Function2<Integer,String,String> _function_1 = new Function2<Integer,String,String>() { public String apply(Integer i , String s) { String _operator_plus_1 = StringExtensions.operator_plus(s, " "); return _operator_plus_1; } }; String _fold_1 = IterableExtensions.<Integer, String>fold(_operator_upTo, "", _function_1); _builder.append(_fold_1, " "); _builder.append("return "); { Collection<EObject> _accessedContexts = this.getAccessedContexts(type_1); int _size = _accessedContexts.size(); boolean _operator_equals = ObjectExtensions.operator_equals(((Object)_size), ((Object)1)); if (_operator_equals) { _builder.append("singleton((EObject)grammarAccess."); Collection<EObject> _accessedContexts_1 = this.getAccessedContexts(type_1); Iterator<EObject> _iterator = _accessedContexts_1.iterator(); EObject _next = _iterator.next(); String _gaAccessor = this.grammarAccess.gaAccessor(_next); _builder.append(_gaAccessor, " "); _builder.append(")");} else { _builder.append("findContexts(("); GenClass _genClass = GenModelAccess.getGenClass(type_1); String _interfaceName = _genClass.getInterfaceName(); _builder.append(_interfaceName, " "); _builder.append(")obj)"); } } _builder.append(";"); _builder.newLineIfNotEmpty(); } } _builder.append("\t"); _builder.append("}\t\t"); _builder.newLine(); } } _builder.append("\t"); _builder.append("return Collections.emptyList();"); _builder.newLine(); _builder.append("}"); _builder.newLine(); _builder.newLine(); { Iterable<EClass> _accessedClasses_2 = this.getAccessedClasses(); final Function1<EClass,Boolean> _function_2 = new Function1<EClass,Boolean>() { public Boolean apply(EClass e) { Collection<EObject> _accessedContexts_2 = AbstractSemanticSequencer.this.getAccessedContexts(e); int _size_1 = _accessedContexts_2.size(); boolean _operator_greaterThan_1 = ComparableExtensions.<Integer>operator_greaterThan(((Comparable<? super Integer>)_size_1), 1); return ((Boolean)_operator_greaterThan_1); } }; Iterable<EClass> _filter = IterableExtensions.<EClass>filter(_accessedClasses_2, _function_2); for(EClass type_2 : _filter) { _builder.newLine(); } } String _string = _builder.toString(); return _string; } There is a compilation error in this part: final Function2<EClass,? super Integer,Integer> _function = new Function2<EClass,? super Integer,Integer>() { public Integer apply(EClass type , Integer max) { final EClass typeConverted_type = (EClass)type; String _genIntLiteral = GenModelAccess.getGenIntLiteral(typeConverted_type); int _length = _genIntLiteral.length(); final Integer typeConverted_max = (Integer)max; int _max = Math.max(_length, typeConverted_max); return ((Integer)_max); } }; The compilation error is : Description Path Resource Location Type The type new Function2(){} cannot extend or implement Functions.Function2<EClass,? super Integer,Integer>. A supertype may not specify any wildcard /org.eclipse.xtext.generator/xtend-gen/org/eclipse/xtext/generator/serializer AbstractSemanticSequencer.java line 320 Java Problem
Holger, could you please verify that the problem is gone for the sample file and close this one?
Works for me.
Closing all bugs that were set to RESOLVED before Neon.0