11package io .quarkus .arc .processor ;
22
3- import java .io .StringWriter ;
4- import java .io .Writer ;
53import java .util .ArrayList ;
6- import java .util .HashMap ;
74import java .util .List ;
8- import java .util .Map ;
95import java .util .function .Function ;
106
117import io .quarkus .arc .processor .ResourceOutput .Resource ;
128import io .quarkus .arc .processor .ResourceOutput .Resource .SpecialType ;
9+ import io .quarkus .gizmo2 .ClassOutput ;
1310
14- public class ResourceClassOutput implements io . quarkus . gizmo . ClassOutput , io . quarkus . gizmo2 . ClassOutput {
11+ public class ResourceClassOutput implements ClassOutput {
1512
1613 private static final Function <String , SpecialType > NO_SPECIAL_TYPE = cn -> null ;
1714
1815 private final List <Resource > resources = new ArrayList <>();
19- private final Map <String , StringWriter > sources ;
2016 private final boolean applicationClass ;
2117 private final Function <String , SpecialType > specialTypeFunction ;
2218
19+ // note that the `generateSource` parameters are unused for now,
20+ // until https://github.com/quarkusio/gizmo/issues/419 is implemented
21+
2322 /**
2423 * @param applicationClass whether the generated classes are application classes or not
2524 * @param generateSource whether to also generate textual representation of the code
@@ -39,7 +38,6 @@ public ResourceClassOutput(boolean applicationClass, Function<String, SpecialTyp
3938 this .applicationClass = applicationClass ;
4039 this .specialTypeFunction = specialTypeFunction ;
4140 // Note that ResourceClassOutput is never used concurrently
42- this .sources = generateSource ? new HashMap <>() : null ;
4341 }
4442
4543 @ Override
@@ -50,28 +48,10 @@ public void write(String name, byte[] data) {
5048 }
5149 String className = name .replace ('/' , '.' );
5250 resources .add (ResourceImpl .javaClass (name , data , specialTypeFunction .apply (className ),
53- applicationClass , getSource (name )));
54- }
55-
56- @ Override
57- public Writer getSourceWriter (String className ) {
58- if (sources != null ) {
59- StringWriter writer = new StringWriter ();
60- sources .put (className , writer );
61- return writer ;
62- }
63- return io .quarkus .gizmo .ClassOutput .super .getSourceWriter (className );
51+ applicationClass , null ));
6452 }
6553
6654 List <Resource > getResources () {
6755 return resources ;
6856 }
69-
70- String getSource (String className ) {
71- if (sources == null ) {
72- return null ;
73- }
74- StringWriter source = sources .get (className );
75- return source != null ? source .toString () : null ;
76- }
7757}
0 commit comments