MCPcopy Create free account
hub / github.com/LFYSec/MScan / build

Method build

src/main/java/pascal/taie/language/classes/JClass.java:105–142  ·  view source on GitHub ↗

This method should be called after creating this instance.

(JClassBuilder builder)

Source from the content-addressed store, hash-verified

103 * This method should be called after creating this instance.
104 */
105 public void build(JClassBuilder builder) {
106 simpleName = builder.getSimpleName();
107 type = builder.getClassType();
108 gSignature = builder.getGSignature();
109 modifiers = builder.getModifiers();
110 annotationHolder = builder.getAnnotationHolder();
111 isApplication = builder.isApplication();
112 isPhantom = builder.isPhantom();
113 try {
114 superClass = builder.getSuperClass();
115 interfaces = builder.getInterfaces();
116 outerClass = builder.getOuterClass();
117 declaredFields = Maps.unmodifiableMultiMap(
118 builder.getDeclaredFields()
119 .stream()
120 .collect(MultiMapCollector.get(
121 () -> Maps.newMultiMap(Maps.newLinkedHashMap(),
122 Sets::newHybridOrderedSet),
123 JField::getName, f -> f))
124 );
125 declaredMethods = Collections.unmodifiableMap(
126 builder.getDeclaredMethods()
127 .stream()
128 .collect(Collectors.toMap(JMethod::getSubsignature, m -> m,
129 (oldV, newV) -> oldV, Maps::newLinkedHashMap))
130 );
131 } catch (Exception e) {
132 if (World.get().getOptions().isAllowPhantom()) {
133 superClass = getClassLoader().loadClass(ClassNames.OBJECT);
134 interfaces = Collections.emptySet();
135 outerClass = null;
136 declaredFields = Maps.emptyMultiMap();
137 declaredMethods = Map.of();
138 } else {
139 throw e;
140 }
141 }
142 }
143
144 public JClassLoader getClassLoader() {
145 return loader;

Callers

nothing calls this directly

Calls 15

unmodifiableMultiMapMethod · 0.95
getMethod · 0.95
newMultiMapMethod · 0.95
newLinkedHashMapMethod · 0.95
getMethod · 0.95
getClassLoaderMethod · 0.95
emptyMultiMapMethod · 0.95
streamMethod · 0.80
isAllowPhantomMethod · 0.80
getSimpleNameMethod · 0.65
getClassTypeMethod · 0.65
getGSignatureMethod · 0.65

Tested by

no test coverage detected