From e102be912e8d0653988993fdbf9ab79d8eb5afb5 Mon Sep 17 00:00:00 2001 From: Aosen Xiong Date: Mon, 18 Sep 2023 11:34:05 -0400 Subject: [PATCH] uncomment newclass in inferencevisitor --- src/checkers/inference/InferenceVisitor.java | 100 +++++++++---------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/src/checkers/inference/InferenceVisitor.java b/src/checkers/inference/InferenceVisitor.java index c79c7f32..f9496c6c 100644 --- a/src/checkers/inference/InferenceVisitor.java +++ b/src/checkers/inference/InferenceVisitor.java @@ -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 typeargs = fromUse.typeArgs; - - List passedArguments = tree.getArguments(); - List 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 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 typeargs = fromUse.typeArgs; +// +// List passedArguments = tree.getArguments(); +// List 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 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) {