• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pmd / pmd / 315

18 Dec 2025 03:00PM UTC coverage: 78.963% (+0.2%) from 78.784%
315

push

github

adangel
[doc] Explain how to build or pull snapshot dependencies for single module builds (#6287)

18491 of 24300 branches covered (76.09%)

Branch coverage included in aggregate %.

40287 of 50137 relevant lines covered (80.35%)

0.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.3
/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/ExprMirror.java
1
/*
2
 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3
 */
4

5
package net.sourceforge.pmd.lang.java.types.internal.infer;
6

7
import static net.sourceforge.pmd.lang.java.types.internal.infer.ExprMirror.TypeSpecies.UNKNOWN;
8
import static net.sourceforge.pmd.lang.java.types.internal.infer.ExprMirror.TypeSpecies.getSpecies;
9
import static net.sourceforge.pmd.lang.java.types.internal.infer.MethodResolutionPhase.STRICT;
10

11
import java.util.List;
12
import java.util.function.Predicate;
13

14
import org.checkerframework.checker.nullness.qual.NonNull;
15
import org.checkerframework.checker.nullness.qual.Nullable;
16

17
import net.sourceforge.pmd.lang.java.ast.JavaNode;
18
import net.sourceforge.pmd.lang.java.ast.MethodUsage;
19
import net.sourceforge.pmd.lang.java.symbols.JConstructorSymbol;
20
import net.sourceforge.pmd.lang.java.types.JClassType;
21
import net.sourceforge.pmd.lang.java.types.JMethodSig;
22
import net.sourceforge.pmd.lang.java.types.JTypeMirror;
23
import net.sourceforge.pmd.lang.java.types.JTypeVar;
24
import net.sourceforge.pmd.lang.java.types.OverloadSelectionResult;
25
import net.sourceforge.pmd.lang.java.types.TypeOps;
26
import net.sourceforge.pmd.lang.java.types.TypeSystem;
27
import net.sourceforge.pmd.lang.java.types.TypingContext;
28
import net.sourceforge.pmd.util.OptionalBool;
29

30
/**
31
 * Adapter class to manipulate expressions. The framework
32
 * ideally keeps focus on types and doesn't have a dependency
33
 * on the AST. Only the impl package can have such dependencies.
34
 */
35
public interface ExprMirror {
36

37
    /**
38
     * Returns a node which is used as a location to report messages.
39
     * Do not use this any other way.
40
     */
41
    JavaNode getLocation();
42

43
    /**
44
     * Return the text of the location node. May be overridden if this
45
     * mirror is fake (eg, using a lambda node but presenting a method ref,
46
     * or using a method ref node but presenting an invocation).
47
     * Use this only to log messages and for debugging.
48
     */
49
    default CharSequence getLocationText() {
50
        return getLocation().getText();
1✔
51
    }
52

53

54
    /**
55
     * If this expression is of a standalone form, returns the type of
56
     * the expression. Otherwise returns null.
57
     *
58
     * <p>Note that standalone types can directly be set on the type
59
     * node.
60
     *
61
     * @return The type of the expression if it is standalone
62
     */
63
    @Nullable JTypeMirror getStandaloneType();
64

65
    /**
66
     * For a standalone expr, finish type inference by computing properties
67
     * that are guarded by the type res lock. For instance for a standalone
68
     * ctor call, the standalone type is trivially known (it's the type node).
69
     * But we still need to do overload resolution.
70
     */
71
    default void finishStandaloneInference(@NonNull JTypeMirror standaloneType) {
72
        // do nothing
73
    }
1✔
74

75

76
    /**
77
     * Set the type of the underlying ast node. Used when we need
78
     * to find out the type of a poly to infer the type of another,
79
     * that way, we don't repeat computation.
80
     */
81
    void setInferredType(JTypeMirror mirror);
82

83
    /** Return the value set in the last call to {@link #setInferredType(JTypeMirror)}. */
84
    @Nullable JTypeMirror getInferredType();
85

86
    /**
87
     * Returns typing information for the lambdas parameters in scope
88
     * in this expression and its subexpressions. When overload resolution
89
     * involves lambdas, we might have to try several target types for each
90
     * lambda. Each of those may give a different type to the lambda parameters,
91
     * and hence, to every expression in the lambda body. These "tentative"
92
     * typing are kept in the {@link TypingContext} object and only
93
     * committed to the AST for the overload that is selected in the end.
94
     */
95
    TypingContext getTypingContext();
96

97
    /**
98
     * Returns the species that this expression produces. The species
99
     * may be known even if the expr is not standalone. For example a
100
     * diamond constructor call is not standalone, but its species is
101
     * obviously REFERENCE.
102
     *
103
     * <p>This is used for specificity tests for lambdas. They use species
104
     * because invocation needs to be done exactly once, and the actual
105
     * type of the expression may differ depending on the selected overload.
106
     * Eg given the signatures {@code <T>foo(Supplier<T>)} and {@code foo(Runnable)},
107
     * the expression {@code foo(() -> new List<>())} must select the supplier
108
     * overload, even before the invocation type of {@code List<>} is known.
109
     * The overload selection compares the expected species of both function
110
     * types (REFERENCE for Supplier, VOID for Runnable), and determines that
111
     * the supplier is more appropriate.
112
     */
113
    default @NonNull TypeSpecies getStandaloneSpecies() {
114
        JTypeMirror std = getStandaloneType();
1✔
115
        return std == null ? UNKNOWN : getSpecies(std);
1!
116
    }
117

118

119
    /**
120
     * Returns true if this mirror and its subexpressions are equivalent
121
     * to the underlying AST node. This is only relevant when making mirrors
122
     * that are not exactly equal to the AST node (eg, omitting explicit type arguments),
123
     * in order to check if the transformation does not change the meaning of the program.
124
     * It verifies that method and constructor calls are overload-selected
125
     * to the same compile-time declaration, and that nested lambdas
126
     * have the same type as in the AST.
127
     *
128
     * <p>This mirror's state, as filled-in during type resolution by
129
     * {@link Infer} using the various setters of {@link ExprMirror}
130
     * interfaces, is compared to the AST's corresponding state. Consequently,
131
     * if this state is missing (meaning, that no overload resolution
132
     * has been run using this mirror), the analysis cannot be performed
133
     * and an exception is thrown.
134
     *
135
     * @throws IllegalStateException If this mirror has not been used for overload resolution
136
     */
137
    boolean isEquivalentToUnderlyingAst();
138

139

140
    /**
141
     * Ground this expression and any expressions that might have been
142
     * assigned a type/ other data during type inference of this node.
143
     * This is called when inference in a parent expression failed, to
144
     * clean up partial data like type inference.
145
     *
146
     * <p>This is only called if the invocation fails, not when testing
147
     * for applicability. The reason is that this is really only relevant
148
     * for lambdas (to reset the type of their parameters), and those are
149
     * not relevant to applicability.
150
     */
151
    default void groundTree() {
152
        setInferredType(ensureNoTypeVariables(getInferredType()));
1✔
153
    }
1✔
154

155
    static JTypeMirror ensureNoTypeVariables(JTypeMirror ty) {
156
        if (ty == null) {
1✔
157
            return null;
1✔
158
        }
159
        return ty.subst(InferenceContext.finalGroundSubst());
1✔
160
    }
161

162
    static JMethodSig ensureNoTypeVariables(JMethodSig ty) {
163
        if (ty == null) {
1!
164
            return null;
×
165
        }
166
        return ty.subst(InferenceContext.finalGroundSubst());
1✔
167
    }
168

169
    /** A general category of types. */
170
    enum TypeSpecies {
1✔
171
        PRIMITIVE,
1✔
172
        REFERENCE,
1✔
173
        VOID,
1✔
174
        UNKNOWN;
1✔
175

176

177
        public static TypeSpecies getSpecies(JTypeMirror t) {
178
            if (t.isPrimitive()) {
1✔
179
                return PRIMITIVE;
1✔
180
            } else if (t.isVoid()) {
1✔
181
                return VOID;
1✔
182
            } else if (TypeOps.isSpecialUnresolved(t)) {
1!
183
                return UNKNOWN;
×
184
            }
185
            return REFERENCE;
1✔
186
        }
187
    }
188

189

190
    interface PolyExprMirror extends ExprMirror {
191

192

193
        /**
194
         * Returns the class declaration wherein this invocation occurs.
195
         * Returns null if it's unresolved.
196
         */
197
        @NonNull JClassType getEnclosingType();
198

199

200
        @Override
201
        default @Nullable JTypeMirror getStandaloneType() {
202
            return null;
1✔
203
        }
204

205

206
        /**
207
         * If inference failed to determine the type of this node, returns
208
         * a fallback for it. This should not query the context of the expression,
209
         * or nodes whose type is unstable because it may be being inferred.
210
         *
211
         * <p>If no fallback should be used, returns null.
212
         */
213
        default @Nullable JTypeMirror unresolvedType() {
214
            return null;
1✔
215
        }
216
    }
217

218

219
    /** Mirrors a conditional or switch expression. */
220
    interface BranchingMirror extends PolyExprMirror {
221

222
        /**
223
         * Returns true if every result expression matches the given
224
         * predicate.
225
         */
226
        boolean branchesMatch(Predicate<? super ExprMirror> condition);
227

228
        /**
229
         * Record on the AST node that is is a standalone expression.
230
         * This accounts for special cases in the spec which are made
231
         * for numeric and boolean conditional expressions. For those
232
         * types of standalone exprs, the branches may have an additional
233
         * implicit unboxing/widening conversion, that does not depend
234
         * on the usual target type (the context of the ternary itself),
235
         * but just on the other branch.
236
         */
237
        default void setStandalone() {
238
            // do nothing by default
239
        }
1✔
240

241

242
        @Override
243
        default boolean isEquivalentToUnderlyingAst() {
244
            return branchesMatch(ExprMirror::isEquivalentToUnderlyingAst);
×
245
        }
246
    }
247

248
    /**
249
     * Mirror of some expression that targets a functional interface type:
250
     * lambda or method reference.
251
     */
252
    interface FunctionalExprMirror extends PolyExprMirror {
253

254
        /**
255
         * For a method ref or lambda, this is the type of the functional interface.
256
         * E.g. in {@code stringStream.map(String::isEmpty)}, this is
257
         * {@code java.util.function.Function<java.lang.String, java.lang.Boolean>}
258
         *
259
         * <p>May be null if we're resetting some partial data.
260
         */
261
        @Override
262
        void setInferredType(@Nullable JTypeMirror mirror);
263

264

265
        /**
266
         * This is the method that is overridden in getInferredType.
267
         * E.g. in {@code stringStream.map(String::isEmpty)}, this is
268
         * {@code java.util.function.Function<java.lang.String, java.lang.Boolean>.apply(java.lang.String) ->
269
         * java.lang.Boolean}
270
         *
271
         * <p>May be null if we're resetting some partial data.
272
         */
273
        void setFunctionalMethod(@Nullable JMethodSig methodType);
274

275
        /**
276
         * If the matching between this expr and its target type failed,
277
         * finish the inference by setting the data to UNKNOWN, or likely
278
         * values. This is used as a fallback.
279
         *
280
         * @param targetType Target type for the expression, null if there is none
281
         */
282
        void finishFailedInference(@Nullable JTypeMirror targetType);
283
    }
284

285
    /**
286
     * Common interface for {@link InvocationMirror} and {@link MethodRefMirror},
287
     * both of which wrap nods that implement {@link MethodUsage}.
288
     */
289
    interface MethodUsageMirror extends PolyExprMirror {
290

291
        /**
292
         * Set the compile-time declaration that was resolved for this method usage.
293
         */
294
        void setCompileTimeDecl(InvocationMirror.MethodCtDecl methodType);
295

296
        /**
297
         * Return the type in which the search for accessible methods start.
298
         * For method references it is the type of the LHS and is specified by
299
         * the JLS. For method invocations it is the type of the receiver, or
300
         * the type of the enclosing type. For constructor invocations this
301
         * is not defined and will return null.
302
         */
303
        @Nullable JTypeMirror getTypeToSearch();
304
    }
305

306
    /**
307
     * Mirror of a method reference expression.
308
     */
309
    interface MethodRefMirror extends FunctionalExprMirror, MethodUsageMirror {
310

311
        /** True if this references a ctor. */
312
        boolean isConstructorRef();
313

314

315
        /**
316
         * Returns the type to search as defined by the first section of
317
         * <a href="https://docs.oracle.com/javase/specs/jls/se9/html/jls-15.html#jls-15.13.1">JLS§15.13.1</a>
318
         * , except it may also return an array type (the jls makes an exception for it,
319
         * while we don't).
320
         */
321
        @Override
322
        @NonNull JTypeMirror getTypeToSearch();
323

324

325
        /**
326
         * Returns the type of the left hand-side, if it is not an expression.
327
         * Note that the following qualifier super forms are considered "expressions",
328
         * that have a context-dependent type (depends on the type of the {@code this} expr):
329
         * <pre>
330
         * super :: [TypeArguments] Identifier
331
         * TypeName.super :: [TypeArguments] Identifier
332
         * </pre>
333
         */
334
        @Nullable
335
        JTypeMirror getLhsIfType();
336

337
        default boolean isLhsAType() {
338
            return getLhsIfType() != null;
1✔
339
        }
340

341
        /**
342
         * Returns the name of the invoked method, or {@link JConstructorSymbol#CTOR_NAME}
343
         * if this is a constructor reference.
344
         */
345
        String getMethodName();
346

347

348
        /** Returns the explicit type arguments (the ones to the right of the "::"). */
349
        @NonNull List<JTypeMirror> getExplicitTypeArguments();
350

351
        /**
352
         * This is the method that is referenced.
353
         * E.g. in {@code stringStream.map(String::isEmpty)}, this is
354
         * {@code java.lang.String.isEmpty() -> boolean}
355
         */
356
        @Override
357
        void setCompileTimeDecl(InvocationMirror.MethodCtDecl methodType);
358

359

360
        /**
361
         * UNRESOLVED_METHOD if not yet computed, null if computed but
362
         * inexact, otherwise the real method.
363
         */
364
        @Nullable
365
        JMethodSig getCachedExactMethod();
366

367

368
        void setCachedExactMethod(@Nullable JMethodSig sig);
369

370
    }
371

372
    /** Mirrors a lambda expression. */
373
    interface LambdaExprMirror extends FunctionalExprMirror {
374

375
        /**
376
         * Returns the types of the explicit parameters. If the lambda
377
         * is implicitly typed, then returns null. If some parameters
378
         * have a var type, returns {@link TypeSystem#UNKNOWN} for those.
379
         *
380
         * <p>Note that a degenerate case of explicitly typed lambda
381
         * expression is a lambda with zero formal parameters.
382
         */
383
        @Nullable List<JTypeMirror> getExplicitParameterTypes();
384

385
        /**
386
         * See {@link #getExplicitParameterTypes()}.
387
         */
388
        default boolean isExplicitlyTyped() {
389
            return getExplicitParameterTypes() != null;
1✔
390
        }
391

392
        /**
393
         * Return the number of parameters of the lambda, regardless of
394
         * whether it's explicitly typed or not.
395
         */
396
        int getParamCount();
397

398

399
        /**
400
         * Returns all the expressions that appear in {@code return}
401
         * statements within the lambda. If this is an expression-bodied
402
         * lambda, returns the expression.
403
         */
404
        Iterable<ExprMirror> getResultExpressions();
405

406

407
        /**
408
         * Returns true if the body is value-compatible {@literal (JLS§15.27.2)}.
409
         * <blockquote>
410
         *     A block lambda body is value-compatible if it cannot complete
411
         *     normally (§14.21) and every return statement in the block
412
         *     has the form return Expression;.
413
         * </blockquote>
414
         */
415
        boolean isValueCompatible();
416

417
        /**
418
         * Returns true if the body is void-compatible {@literal (JLS§15.27.2)}.
419
         * <blockquote>
420
         *     A block lambda body is void-compatible if every return
421
         *     statement in the block has the form return;.
422
         * </blockquote>
423
         */
424
        boolean isVoidCompatible();
425

426
        /**
427
         * Set the currently considered type of the parameters.
428
         * This may change depending on which target type we are currently
429
         * considering. The type of parameters (and therefore the typing context)
430
         * may influence the type of the return values of the lambda.
431
         *
432
         * @param formalParameters formal parameter types of the lambda
433
         */
434
        void updateTypingContext(List<? extends JTypeMirror> formalParameters);
435
    }
436

437
    /**
438
     * Adapter over a method or constructor invocation expression.
439
     */
440
    interface InvocationMirror extends PolyExprMirror, MethodUsageMirror {
441

442

443
        /**
444
         * Enumerates *accessible* method (or ctor) signatures with
445
         * *the same name* as this invocation. Name and accessibility
446
         * will not be checked later.
447
         *
448
         * The details on how to determine this are here:
449
         *
450
         * https://docs.oracle.com/javase/specs/jls/se9/html/jls-15.html#jls-15.12.1
451
         */
452
        Iterable<JMethodSig> getAccessibleCandidates();
453

454

455
        /**
456
         * Returns the erased receiver type. This is only used to adapt the
457
         * {@code Object::getClass} method, other types of invocations don't
458
         * need to implement this.
459
         */
460
        default @Nullable JTypeMirror getErasedReceiverType() {
461
            return null;
×
462
        }
463

464

465
        /**
466
         * Returns the erased receiver type. This is only used for method
467
         * invocations.
468
         */
469
        @Nullable JTypeMirror getReceiverType();
470

471

472
        /**
473
         * Returns the explicit type arguments, eg in {@code Arrays.<String>asList("q")},
474
         * or {@code new <String> Foo("q")}. If none are mentioned, returns an empty list.
475
         */
476
        List<JTypeMirror> getExplicitTypeArguments();
477

478

479
        /**
480
         * @throws IndexOutOfBoundsException If there's no explicit type argument at the given index
481
         */
482
        JavaNode getExplicitTargLoc(int i);
483

484

485
        /**
486
         * Returns the name of the invoked method. If this is a
487
         * constructor call, returns {@link JConstructorSymbol#CTOR_NAME}.
488
         */
489
        String getName();
490

491

492
        /** Returns the expressions corresponding to the arguments of the call. */
493
        List<ExprMirror> getArgumentExpressions();
494

495

496
        /** Return the size of the argument list. */
497
        int getArgumentCount();
498

499

500
        /**
501
         * {@inheritDoc}
502
         *
503
         * @implSpec Should cache this value and return it when {@link #getCtDecl()}
504
         * is called.
505
         */
506
        @Override
507
        void setCompileTimeDecl(MethodCtDecl methodType);
508

509

510
        /**
511
         * Returns the method type set with {@link #setCompileTimeDecl(MethodCtDecl)}
512
         * or null if that method was never called. This is used to perform
513
         * overload resolution exactly once per call site.
514
         */
515
        @Nullable MethodCtDecl getCtDecl();
516

517
        @Override
518
        default @Nullable JTypeMirror getTypeToSearch() {
519
            return getReceiverType();
×
520
        }
521

522

523
        /**
524
         * Information about the overload-resolution for a specific method.
525
         */
526
        class MethodCtDecl implements OverloadSelectionResult {
527
            // note this data is gathered by the MethodCallSite during
528
            // applicability inference, stashed in this object, and
529
            // restored when we do invocation.
530

531
            private final JMethodSig methodType;
532
            private final MethodResolutionPhase resolvePhase;
533
            private final boolean canSkipInvocation;
534
            private final OptionalBool needsUncheckedConversion;
535
            private final boolean failed;
536
            private final @Nullable MethodUsageMirror expr;
537

538
            MethodCtDecl(JMethodSig methodType,
539
                         MethodResolutionPhase resolvePhase,
540
                         boolean canSkipInvocation,
541
                         OptionalBool needsUncheckedConversion,
542
                         boolean failed,
543
                         @Nullable MethodUsageMirror expr) {
1✔
544
                this.methodType = methodType;
1✔
545
                this.resolvePhase = resolvePhase;
1✔
546
                this.canSkipInvocation = canSkipInvocation;
1✔
547
                this.needsUncheckedConversion = needsUncheckedConversion;
1✔
548
                this.failed = failed;
1✔
549
                this.expr = expr;
1✔
550
            }
1✔
551

552
            // package-private:
553

554
            public MethodCtDecl withMethod(JMethodSig method) {
555
                return withMethod(method, failed);
1✔
556
            }
557

558
            MethodCtDecl withMethod(JMethodSig method, boolean failed) {
559
                return new MethodCtDecl(method, resolvePhase, canSkipInvocation, needsUncheckedConversion, failed, expr);
1✔
560
            }
561

562
            public MethodCtDecl withExpr(MethodUsageMirror expr) {
563
                return new MethodCtDecl(methodType, resolvePhase, canSkipInvocation, needsUncheckedConversion, failed, expr);
1✔
564
            }
565

566
            MethodCtDecl asFailed() {
567
                return withMethod(methodType, true);
1✔
568
            }
569

570
            boolean canSkipInvocation() {
571
                return canSkipInvocation;
1✔
572
            }
573

574
            MethodResolutionPhase getResolvePhase() {
575
                return resolvePhase;
1✔
576
            }
577

578
            static MethodCtDecl unresolved(TypeSystem ts) {
579
                return new MethodCtDecl(ts.UNRESOLVED_METHOD, STRICT, true, OptionalBool.UNKNOWN, true, null);
1✔
580
            }
581

582
            // public:
583

584

585
            @Override
586
            public JMethodSig getMethodType() {
587
                return methodType;
1✔
588
            }
589

590
            @Override
591
            public boolean needsUncheckedConversion() {
592
                return needsUncheckedConversion.isTrue();
1✔
593
            }
594

595
            @Override
596
            public boolean isVarargsCall() {
597
                return resolvePhase.requiresVarargs();
1✔
598
            }
599

600
            @Override
601
            public boolean isFailed() {
602
                return failed;
1✔
603
            }
604

605
            @Override
606
            public String toString() {
607
                return "CtDecl[phase=" + resolvePhase + ", method=" + methodType + ']';
×
608
            }
609

610
            @Override
611
            public @Nullable JTypeMirror getTypeToSearch() {
612
                return expr != null ? expr.getTypeToSearch() : null;
1✔
613
            }
614
        }
615
    }
616

617
    /**
618
     * An invocation mirror reflecting a constructor invocation expression.
619
     */
620
    interface CtorInvocationMirror extends InvocationMirror {
621

622
        /**
623
         * Return the type name being instantiated. If the constructor call
624
         * is a diamond invocation (or no type args), returns the generic type declaration.
625
         * Otherwise returns the parameterised type. If the call declares
626
         * an anonymous class, then this does *not* return the anonymous
627
         * type, but its explicit supertype.
628
         *
629
         * <ul>
630
         *  <li>e.g. for {@code new ArrayList<>()}, returns {@code ArrayList<T>}.
631
         *  <li>e.g. for {@code new ArrayList()}, returns {@code ArrayList}.
632
         *  <li>e.g. for {@code new ArrayList<String>()}, returns {@code ArrayList<String>}.
633
         *  <li>e.g. for {@code new Runnable() {}} (anonymous), returns {@code Runnable}.
634
         * </ul>
635
         *
636
         * <p>Note that this returns a {@link JClassType} in valid code.
637
         * Other return values may be eg {@link TypeSystem#UNKNOWN}, or
638
         * a {@link JTypeVar}, but indicate malformed code.
639
         */
640
        @NonNull JTypeMirror getNewType();
641

642
        /**
643
         * True if this creates an anonymous class. Since java 9 those
644
         * can also be diamond-inferred.
645
         */
646
        boolean isAnonymous();
647

648
        /**
649
         * Return true if this is a diamond constructor call. In that
650
         * case the type parameters of the created instance must be inferred.
651
         * Returns false if the constructor call mentions no type arguments.
652
         * <ul>
653
         *  <li>e.g. for {@code new ArrayList<>()}, returns true.
654
         *  <li>e.g. for {@code new ArrayList()}, returns false.
655
         *  <li>e.g. for {@code new ArrayList<String>()}, returns false.
656
         * </ul>
657
         */
658
        boolean isDiamond();
659

660

661
        /**
662
         * {@inheritDoc}
663
         *
664
         * <p>Returns the constructor of the {@link #getNewType()}. If
665
         * this is an anonymous class declaration implementing an interface,
666
         * then returns the constructors of class {@link Object}.
667
         *
668
         * <p>This default implementation uses {@link #getAccessibleCandidates(JTypeMirror)},
669
         * which should be implemented instead.
670
         */
671
        @Override
672
        default Iterable<JMethodSig> getAccessibleCandidates() {
673
            return getAccessibleCandidates(getNewType());
1✔
674
        }
675

676
        /**
677
         * Returns the accessible candidates for this node, as if {@link #getNewType()}
678
         * returned the type passed as parameter. Since candidates depend on the
679
         * new type, this allows us to write simple "spy" wrappers to redo an invocation
680
         * in different conditions (ie, pretending the newtype is the parameter)
681
         *
682
         * @param newType Assumed value of {@link #getNewType()}
683
         */
684
        Iterable<JMethodSig> getAccessibleCandidates(JTypeMirror newType);
685

686

687
        /** Must return {@link JConstructorSymbol#CTOR_NAME}. */
688
        @Override
689
        default String getName() {
690
            return JConstructorSymbol.CTOR_NAME;
×
691
        }
692

693

694
    }
695
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc