< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java

Print this page

        

*** 28,37 **** --- 28,38 ---- package com.sun.tools.javac.comp; import java.util.HashMap; import java.util.HashSet; import java.util.Set; + import java.util.stream.Collectors; import com.sun.source.tree.LambdaExpressionTree.BodyKind; import com.sun.tools.javac.code.*; import com.sun.tools.javac.code.Scope.WriteableScope; import com.sun.tools.javac.code.Source.Feature;
*** 1955,1975 **** scan(tree.body); if (isInitialConstructor) { boolean isSynthesized = (tree.sym.flags() & GENERATEDCONSTR) != 0; ! for (int i = firstadr; i < nextadr; i++) { ! JCVariableDecl vardecl = vardecls[i]; ! VarSymbol var = vardecl.sym; ! if (var.owner == classDef.sym) { ! // choose the diagnostic position based on whether ! // the ctor is default(synthesized) or not ! if (isSynthesized) { ! checkInit(TreeInfo.diagnosticPositionFor(var, vardecl), ! var, Errors.VarNotInitializedInDefaultConstructor(var)); ! } else { ! checkInit(TreeInfo.diagEndPos(tree.body), var); } } } } List<PendingExit> exits = pendingExits.toList(); --- 1956,1980 ---- scan(tree.body); if (isInitialConstructor) { boolean isSynthesized = (tree.sym.flags() & GENERATEDCONSTR) != 0; ! boolean isRecord = (tree.sym.owner.flags() & Flags.RECORD) != 0; ! // skip record as they are generated by the compiler and guaranteed to be correct ! if (!isRecord || !isSynthesized) { ! for (int i = firstadr; i < nextadr; i++) { ! JCVariableDecl vardecl = vardecls[i]; ! VarSymbol var = vardecl.sym; ! if (var.owner == classDef.sym) { ! // choose the diagnostic position based on whether ! // the ctor is default(synthesized) or not ! if (isSynthesized) { ! checkInit(TreeInfo.diagnosticPositionFor(var, vardecl), ! var, Errors.VarNotInitializedInDefaultConstructor(var)); ! } else { ! checkInit(TreeInfo.diagEndPos(tree.body), var); ! } } } } } List<PendingExit> exits = pendingExits.toList();
< prev index next >