Class ShadowChainBuilder<S,I>
- java.lang.Object
-
- net.sourceforge.pmd.lang.java.symbols.table.coreimpl.ShadowChainBuilder<S,I>
-
- Type Parameters:
S- Type of symbolsI- Type of scope tags
public abstract class ShadowChainBuilder<S,I> extends Object
Build a shadow chain for some type.Implementing this framework means implementing
NameResolvers for each relevant way that a declaration may be brought in scope, then figuring out the correct way these resolvers should be linked into a ShadowChain. Shadow chain builders just give some utility methods to make the linking process more straightforward.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classShadowChainBuilder.ResolverBuilderHelper to build a new name resolver.
-
Constructor Summary
Constructors Constructor Description ShadowChainBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ShadowChainNode<S,I>augment(ShadowChainNode<S,I> parent, boolean shadowBarrier, I scopeTag, NameResolver<? extends S> resolver)ShadowChainNode<S,I>augment(ShadowChainNode<S,I> parent, boolean shadowBarrier, I scopeTag, ShadowChainBuilder.ResolverBuilder symbols)ShadowChainNode<S,I>augment(ShadowChainNode<S,I> parent, boolean shadowBarrier, I scopeTag, S symbol)ShadowChainNode<S,I>augmentWithCache(ShadowChainNode<S,I> parent, boolean shadowBarrier, I scopeTag, NameResolver<? extends S> resolver)ShadowChainNode<S,I>augmentWithCache(ShadowChainNode<S,I> parent, boolean shadowBarrier, I scopeTag, NameResolver<? extends S> resolver, BinaryOperator<List<S>> merger)protected <V> Map<String,V>copyToMutable(Map<String,V> m)Copy the given map into a new mutable map.abstract StringgetSimpleName(S sym)Returns the name with which the given symbol should be indexed.<N> ShadowChainBuilder.ResolverBuildergroupByName(Iterable<? extends N> input, Function<? super N,? extends @Nullable S> symbolFetcher)ShadowChainBuilder.ResolverBuildergroupByName(Iterable<? extends S> tparams)NameResolver<S>groupByName(S sym)static <S,I>
ShadowChainNode<S,I>rootGroup()Returns the singleton for the chain root.ShadowChainNode<S,I>shadow(ShadowChainNode<S,I> parent, I scopeTag, NameResolver<S> resolver)ShadowChainNode<S,I>shadow(ShadowChainNode<S,I> parent, I scopeTag, ShadowChainBuilder.ResolverBuilder resolver)ShadowChainNode<S,I>shadow(ShadowChainNode<S,I> parent, I scopeTag, S symbol)ShadowChainNode<S,I>shadowWithCache(ShadowChainNode<S,I> parent, I scopeTag, Map<String,List<S>> cacheMap, NameResolver<S> resolver)
-
-
-
Method Detail
-
copyToMutable
protected <V> Map<String,V> copyToMutable(Map<String,V> m)
Copy the given map into a new mutable map. This is provided as a hook to experiment with alternative map implementations easily, eg tries, or specialized maps.
-
getSimpleName
public abstract String getSimpleName(S sym)
Returns the name with which the given symbol should be indexed.
-
rootGroup
public static <S,I> ShadowChainNode<S,I> rootGroup()
Returns the singleton for the chain root.
-
augment
public ShadowChainNode<S,I> augment(ShadowChainNode<S,I> parent, boolean shadowBarrier, I scopeTag, ShadowChainBuilder.ResolverBuilder symbols)
-
augment
public ShadowChainNode<S,I> augment(ShadowChainNode<S,I> parent, boolean shadowBarrier, I scopeTag, NameResolver<? extends S> resolver)
-
augment
public ShadowChainNode<S,I> augment(ShadowChainNode<S,I> parent, boolean shadowBarrier, I scopeTag, S symbol)
-
augmentWithCache
public ShadowChainNode<S,I> augmentWithCache(ShadowChainNode<S,I> parent, boolean shadowBarrier, I scopeTag, NameResolver<? extends S> resolver)
-
augmentWithCache
public ShadowChainNode<S,I> augmentWithCache(ShadowChainNode<S,I> parent, boolean shadowBarrier, I scopeTag, NameResolver<? extends S> resolver, BinaryOperator<List<S>> merger)
-
shadowWithCache
public ShadowChainNode<S,I> shadowWithCache(ShadowChainNode<S,I> parent, I scopeTag, Map<String,List<S>> cacheMap, NameResolver<S> resolver)
-
shadow
public ShadowChainNode<S,I> shadow(ShadowChainNode<S,I> parent, I scopeTag, ShadowChainBuilder.ResolverBuilder resolver)
-
shadow
public ShadowChainNode<S,I> shadow(ShadowChainNode<S,I> parent, I scopeTag, NameResolver<S> resolver)
-
shadow
public ShadowChainNode<S,I> shadow(ShadowChainNode<S,I> parent, I scopeTag, S symbol)
-
groupByName
public <N> ShadowChainBuilder.ResolverBuilder groupByName(Iterable<? extends N> input, Function<? super N,? extends @Nullable S> symbolFetcher)
-
groupByName
public ShadowChainBuilder.ResolverBuilder groupByName(Iterable<? extends S> tparams)
-
groupByName
public NameResolver<S> groupByName(S sym)
-
-