This method should be called after creating this instance.
(JClassBuilder builder)
| 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; |
nothing calls this directly
no test coverage detected