150 cb.aload(0);
151 cb.invokespecial(CD_Object, INIT_NAME, MTD_void);
152 cb.return_();
153 });
154 }
155
156 void makeCtxk(ClassBuilder clb, boolean isInner) {
157 if (isInner) {
158 clb.with(EnclosingMethodAttribute.of(outerName,
159 Optional.of("f"), Optional.of(MTD_void)));
160 } else {
161 clb.withMethodBody("f", MTD_void, ACC_PUBLIC | ACC_STATIC,
162 CodeBuilder::return_);
163 }
164 }
165
166 byte[] getNestedClasses(boolean isInner) {
167 var name = (isInner ? innerName : outerName);
168 return ClassFile.of().build(name, clb -> {
169 clb.withSuperclass(CD_Object);
170 clb.withFlags(AccessFlag.PUBLIC, AccessFlag.SUPER);
171 clb.with(InnerClassesAttribute.of(
172 InnerClassInfo.of(innerName,
173 Optional.of(outerName),
174 Optional.of(simpleName))));
175 makeDefaultCtor(clb);
176 });
177 }
178
179 byte[] getInnerClasses(boolean isInner) {
180 var name = (isInner ? innerName : outerName);
181 return ClassFile.of().build(name, clb -> {
182 clb.withSuperclass(CD_Object);
183 clb.withFlags(AccessFlag.PUBLIC, AccessFlag.SUPER);
184 clb.with(InnerClassesAttribute.of(
185 InnerClassInfo.of(innerName,
186 Optional.of(outerName),
187 Optional.of(simpleName),
188 AccessFlag.PUBLIC)));
189 makeDefaultCtor(clb);
190 });
191 }
192
193 byte[] getLocalClasses(boolean isInner) {
194 var name = (isInner ? innerName : outerName);
195 return ClassFile.of().build(name, clb -> {
196 clb.withSuperclass(CD_Object);
197 clb.withFlags(AccessFlag.PUBLIC, AccessFlag.SUPER);
198 clb.with(InnerClassesAttribute.of(
199 InnerClassInfo.of(innerName,
200 Optional.empty(),
201 Optional.of(simpleName),
202 AccessFlag.PUBLIC, AccessFlag.STATIC)));
203 makeDefaultCtor(clb);
204 makeCtxk(clb, isInner);
205 });
206 }
207
208 byte[] getAnonymousClasses(boolean isInner) {
209 var name = (isInner ? innerName : outerName);
210 return ClassFile.of().build(name, clb -> {
211 clb.withSuperclass(CD_Object);
212 clb.withFlags(AccessFlag.PUBLIC, AccessFlag.SUPER);
213 clb.with(InnerClassesAttribute.of(
214 InnerClassInfo.of(innerName,
215 Optional.empty(),
216 Optional.empty(),
217 AccessFlag.PUBLIC, AccessFlag.STATIC)));
218 makeDefaultCtor(clb);
219 makeCtxk(clb, isInner);
220 });
221 }
222 }
223 }
|
150 cb.aload(0);
151 cb.invokespecial(CD_Object, INIT_NAME, MTD_void);
152 cb.return_();
153 });
154 }
155
156 void makeCtxk(ClassBuilder clb, boolean isInner) {
157 if (isInner) {
158 clb.with(EnclosingMethodAttribute.of(outerName,
159 Optional.of("f"), Optional.of(MTD_void)));
160 } else {
161 clb.withMethodBody("f", MTD_void, ACC_PUBLIC | ACC_STATIC,
162 CodeBuilder::return_);
163 }
164 }
165
166 byte[] getNestedClasses(boolean isInner) {
167 var name = (isInner ? innerName : outerName);
168 return ClassFile.of().build(name, clb -> {
169 clb.withSuperclass(CD_Object);
170 clb.withFlags(AccessFlag.PUBLIC, AccessFlag.IDENTITY);
171 clb.with(InnerClassesAttribute.of(
172 InnerClassInfo.of(innerName,
173 Optional.of(outerName),
174 Optional.of(simpleName))));
175 makeDefaultCtor(clb);
176 });
177 }
178
179 byte[] getInnerClasses(boolean isInner) {
180 var name = (isInner ? innerName : outerName);
181 return ClassFile.of().build(name, clb -> {
182 clb.withSuperclass(CD_Object);
183 clb.withFlags(AccessFlag.PUBLIC, AccessFlag.IDENTITY);
184 clb.with(InnerClassesAttribute.of(
185 InnerClassInfo.of(innerName,
186 Optional.of(outerName),
187 Optional.of(simpleName),
188 AccessFlag.PUBLIC)));
189 makeDefaultCtor(clb);
190 });
191 }
192
193 byte[] getLocalClasses(boolean isInner) {
194 var name = (isInner ? innerName : outerName);
195 return ClassFile.of().build(name, clb -> {
196 clb.withSuperclass(CD_Object);
197 clb.withFlags(AccessFlag.PUBLIC, AccessFlag.IDENTITY);
198 clb.with(InnerClassesAttribute.of(
199 InnerClassInfo.of(innerName,
200 Optional.empty(),
201 Optional.of(simpleName),
202 AccessFlag.PUBLIC, AccessFlag.STATIC)));
203 makeDefaultCtor(clb);
204 makeCtxk(clb, isInner);
205 });
206 }
207
208 byte[] getAnonymousClasses(boolean isInner) {
209 var name = (isInner ? innerName : outerName);
210 return ClassFile.of().build(name, clb -> {
211 clb.withSuperclass(CD_Object);
212 clb.withFlags(AccessFlag.PUBLIC, AccessFlag.IDENTITY);
213 clb.with(InnerClassesAttribute.of(
214 InnerClassInfo.of(innerName,
215 Optional.empty(),
216 Optional.empty(),
217 AccessFlag.PUBLIC, AccessFlag.STATIC)));
218 makeDefaultCtor(clb);
219 makeCtxk(clb, isInner);
220 });
221 }
222 }
223 }
|