cmccabe commented on a change in pull request #9002:
URL: https://github.com/apache/kafka/pull/9002#discussion_r453713178



##########
File path: 
generator/src/main/java/org/apache/kafka/message/MessageGenerator.java
##########
@@ -169,20 +185,20 @@ public static void processDirectories(String packageName, 
String outputDir, Stri
                         generator.write(writer);
                     }
                     numProcessed++;
-                    messageTypeGenerator.registerMessageType(spec);
+                    if (typeClassGenerator != null) {
+                        typeClassGenerator.registerMessageType(spec);
+                    }
                 } catch (Exception e) {
                     throw new RuntimeException("Exception while processing " + 
inputPath.toString(), e);
                 }
             }
         }
-        if (messageTypeGenerator.hasRegisteredTypes()) {
-            Path factoryOutputPath = Paths.get(outputDir, 
API_MESSAGE_TYPE_JAVA);
-            outputFileNames.add(API_MESSAGE_TYPE_JAVA);
+        if (typeClassGenerator != null) {
+            outputFileNames.add(typeClassGenerator.outputName());
+            Path factoryOutputPath = Paths.get(outputDir, 
typeClassGenerator.outputName());
             try (BufferedWriter writer = 
Files.newBufferedWriter(factoryOutputPath)) {
-                messageTypeGenerator.generate();
-                messageTypeGenerator.write(writer);
+                typeClassGenerator.generateAndWrite(writer);
             }
-            numProcessed++;

Review comment:
       The counter is used to output how many JSON files we processed in the 
`printf` down below. Since this doesn't process a JSON file, yes it was 
incorrect.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to