diff --git a/src/checkers/inference/util/ASTPathUtil.java b/src/checkers/inference/util/ASTPathUtil.java index 73c922b1..649692d2 100644 --- a/src/checkers/inference/util/ASTPathUtil.java +++ b/src/checkers/inference/util/ASTPathUtil.java @@ -74,7 +74,11 @@ public static ASTRecord getASTRecordForPath(final AnnotatedTypeFactory typeFacto * this class. */ public static ASTRecord getConstructorRecord(ASTRecord classRecord) { - return new ASTRecord(classRecord.ast, classRecord.className, AFU_CONSTRUCTOR_ID, null, ASTPath.empty()); + return new ASTRecord(classRecord.ast, classRecord.className, AFU_CONSTRUCTOR_ID, null, getMethodTypeASTPath()); + } + + public static ASTPath getMethodTypeASTPath() { + return ASTPath.empty().extend(new ASTPath.ASTEntry(Tree.Kind.METHOD, ASTPath.TYPE, null)); } /** diff --git a/src/checkers/inference/util/JaifBuilder.java b/src/checkers/inference/util/JaifBuilder.java index 3bffe8f7..07afa45f 100644 --- a/src/checkers/inference/util/JaifBuilder.java +++ b/src/checkers/inference/util/JaifBuilder.java @@ -310,7 +310,12 @@ private void buildClassEntries() { // TODO: this is not a feature but a workaround of a bug: // We should create a non-empty correct ASTPath for constructor if (astRecord.astPath.equals(ASTPath.empty())) { - continue; + if (astRecord.methodName != null && astRecord.methodName.contains("")) { + astRecord = new ASTRecord(astRecord.ast, astRecord.className, + astRecord.methodName, astRecord.varName, ASTPathUtil.getMethodTypeASTPath()); + } else { + continue; + } } memberRecords.entries.add(new RecordValue(astRecord.astPath,annotation));