Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 166499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:06:30+00:00 2026-05-11T12:06:30+00:00

I have a Java Maven project with about 800 source files (some generated by

  • 0

I have a Java Maven project with about 800 source files (some generated by javacc/JTB) which is taking a good 25 minutes to compile with javac.

When I changed my pom.xml over to use the Eclipse compiler, it takes about 30 seconds to compile.

Any suggestions as to why javac (1.5) is running so slowly? (I don’t want to switch over to the Eclipse compiler permanently, as the plugin for Maven seems more than a little buggy.)

I have a test case which easily reproduces the problem. The following code generates a number of source files in the default package. If you try to compile ImplementingClass.java with javac, it will seem to pause for an inordinately long time.

import java.io.File; import java.io.FileNotFoundException; import java.io.PrintStream;  public class CodeGenerator {     private final static String PATH = System.getProperty('java.io.tmpdir');     private final static int NUM_TYPES = 1000;      public static void main(String[] args) throws FileNotFoundException     {         PrintStream interfacePs = new PrintStream(PATH + File.separator + 'Interface.java');         PrintStream abstractClassPs = new PrintStream(PATH + File.separator + 'AbstractClass.java');         PrintStream implementingClassPs = new PrintStream(PATH + File.separator + 'ImplementingClass.java');         interfacePs.println('public interface Interface<T> {');         abstractClassPs.println('public abstract class AbstractClass<T> implements Interface<T> {');         implementingClassPs.println('public class ImplementingClass extends AbstractClass<Object> {');          for (int i=0; i<NUM_TYPES; i++)         {             String nodeName = 'Node' + i;             PrintStream nodePs = new PrintStream(PATH + File.separator + nodeName + '.java');             nodePs.printf('public class %s { }\n', nodeName);             nodePs.close();             interfacePs.printf('void visit(%s node, T obj);%n', nodeName);             abstractClassPs.printf('public void visit(%s node, T obj) { System.out.println(obj.toString()); }%n', nodeName);         }         interfacePs.println('}');         abstractClassPs.println('}');         implementingClassPs.println('}');         interfacePs.close();         abstractClassPs.close();         implementingClassPs.close();     } } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T12:06:31+00:00Added an answer on May 11, 2026 at 12:06 pm

    You get the same behaviour with JDK 1.6, including update 14, build 04, using G1 doesn’t change the behaviour, (though G1 appears to work really well).

    Monitoring javac with jvisualvm, repeated thread dumps show the main thread spending lots of time in

    at com.sun.tools.javac.code.Types.isSubSignature(Types.java:1846) at com.sun.tools.javac.code.Symbol$MethodSymbol.overrides(Symbol.java:1108) at com.sun.tools.javac.code.Symbol$MethodSymbol.implementation(Symbol.java:1159) at com.sun.tools.javac.comp.Check.checkCompatibleConcretes(Check.java:1239) at com.sun.tools.javac.comp.Check.checkCompatibleSupertypes(Check.java:1567) at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:2674) at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2628) at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2564) at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1036) at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:765) at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:730) at com.sun.tools.javac.main.Main.compile(Main.java:353) at com.sun.tools.javac.main.Main.compile(Main.java:279) at com.sun.tools.javac.main.Main.compile(Main.java:270) at com.sun.tools.javac.Main.compile(Main.java:69) at com.sun.tools.javac.Main.main(Main.java:54) 

    and churning through a large number of short lived instances of these classes:

    com.sun.tools.javac.code.Types$Subst com.sun.tools.javac.util.List com.sun.tools.javac.code.Types$MethodType 

    I suspect the code is churning through com.sun.tools.javac.comp.Check.checkCompatibleConcretes comparing each method with every other method

    That method’s javadoc:

    /** Check that a class does not inherit two concrete methods  *  with the same signature.  */ 

    It may be that eclipse’s compiler either doesn’t perform that check, or doesn’t perform it in the same way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 119k
  • Answers 119k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The only way to do this is by actually using… May 11, 2026 at 11:49 pm
  • Editorial Team
    Editorial Team added an answer With CSS: selector { cursor: none; } An example: <div… May 11, 2026 at 11:49 pm
  • Editorial Team
    Editorial Team added an answer The bin/Debug folder is not where the unit tests run.… May 11, 2026 at 11:49 pm

Related Questions

I have a side project I do = in Java. It's a pretty straight-forward
i have some questions about Maven 2 and i hope somebody can clear things
Soon I will have to start a web project for a company, and I
I have a maven project with the following packages (for illustration only): Root: src/main/java

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.