Skip to content

Commit

Permalink
uncomment newclass in inferencevisitor
Browse files Browse the repository at this point in the history
  • Loading branch information
Ao-senXiong committed Sep 18, 2023
1 parent 5bedcd6 commit e102be9
Showing 1 changed file with 50 additions and 50 deletions.
100 changes: 50 additions & 50 deletions src/checkers/inference/InferenceVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -860,56 +860,56 @@ protected void checkConstructorResult(
}
}

@Override
public Void visitNewClass(NewClassTree tree, Void p) {
if (!infer) {
super.visitNewClass(tree, p);
}
if (checker.shouldSkipUses(TreeUtils.elementFromUse(tree))) {
return super.visitNewClass(tree, p);
}

AnnotatedTypeFactory.ParameterizedExecutableType fromUse = atypeFactory.constructorFromUse(tree);
AnnotatedExecutableType constructorType = fromUse.executableType;
List<AnnotatedTypeMirror> typeargs = fromUse.typeArgs;

List<? extends ExpressionTree> passedArguments = tree.getArguments();
List<AnnotatedTypeMirror> params =
AnnotatedTypes.adaptParameters(atypeFactory, constructorType, passedArguments);

ExecutableElement constructor = constructorType.getElement();
CharSequence constructorName = ElementUtils.getSimpleNameOrDescription(constructor);

checkArguments(params, passedArguments, constructorName, constructor.getParameters());
checkVarargs(constructorType, tree);

List<AnnotatedTypeParameterBounds> paramBounds =
CollectionsPlume.mapList(
AnnotatedTypeVariable::getBounds, constructorType.getTypeVariables());

checkTypeArguments(
tree,
paramBounds,
typeargs,
tree.getTypeArguments(),
constructorName,
constructor.getTypeParameters());

boolean valid = validateTypeOf(tree);

if (valid) {
AnnotatedDeclaredType dt = atypeFactory.getAnnotatedType(tree);
atypeFactory.getDependentTypesHelper().checkTypeForErrorExpressions(dt, tree);
checkConstructorInvocation(dt, constructorType, tree);
}
// Do not call super, as that would observe the arguments without
// a set assignment context.
scan(tree.getEnclosingExpression(), p);
scan(tree.getIdentifier(), p);
scan(tree.getClassBody(), p);

return null;
}
// @Override
// public Void visitNewClass(NewClassTree tree, Void p) {
// if (!infer) {
// super.visitNewClass(tree, p);
// }
// if (checker.shouldSkipUses(TreeUtils.elementFromUse(tree))) {
// return super.visitNewClass(tree, p);
// }
//
// AnnotatedTypeFactory.ParameterizedExecutableType fromUse = atypeFactory.constructorFromUse(tree);
// AnnotatedExecutableType constructorType = fromUse.executableType;
// List<AnnotatedTypeMirror> typeargs = fromUse.typeArgs;
//
// List<? extends ExpressionTree> passedArguments = tree.getArguments();
// List<AnnotatedTypeMirror> params =
// AnnotatedTypes.adaptParameters(atypeFactory, constructorType, passedArguments);
//
// ExecutableElement constructor = constructorType.getElement();
// CharSequence constructorName = ElementUtils.getSimpleNameOrDescription(constructor);
//
// checkArguments(params, passedArguments, constructorName, constructor.getParameters());
// checkVarargs(constructorType, tree);
//
// List<AnnotatedTypeParameterBounds> paramBounds =
// CollectionsPlume.mapList(
// AnnotatedTypeVariable::getBounds, constructorType.getTypeVariables());
//
// checkTypeArguments(
// tree,
// paramBounds,
// typeargs,
// tree.getTypeArguments(),
// constructorName,
// constructor.getTypeParameters());
//
// boolean valid = validateTypeOf(tree);
//
// if (valid) {
// AnnotatedDeclaredType dt = atypeFactory.getAnnotatedType(tree);
// atypeFactory.getDependentTypesHelper().checkTypeForErrorExpressions(dt, tree);
// checkConstructorInvocation(dt, constructorType, tree);
// }
// // Do not call super, as that would observe the arguments without
// // a set assignment context.
// scan(tree.getEnclosingExpression(), p);
// scan(tree.getIdentifier(), p);
// scan(tree.getClassBody(), p);
//
// return null;
// }

// @Override
// public Void visitMethodInvocation(MethodInvocationTree node, Void p) {
Expand Down

0 comments on commit e102be9

Please sign in to comment.