Re: Running Sun's javac on Classpath

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mark Wielaard writes:
 > 
 > Note that we have a ServiceFactory class in gnu.classpath with a static
 > method: Iterator lookupProviders(Class, ClassLoader); which most likely
 > does what you want here.

Yep, that works:

 $ gij -jar /mnt/zebedee/compiler/dist/bin/../lib/javac.jar -target 1.5 /home/aph/Hello.java
 $ gij Hello
Hello, world!

I added a new class to Classpath:

----------------------------------------------------------------------------------
package sun.misc;

import gnu.classpath.ServiceFactory;
import java.util.Iterator;

public class Service
{
  public static Iterator providers(Class klass, ClassLoader cl)
  {
    return ServiceFactory.lookupProviders(klass, cl);
  }
}
----------------------------------------------------------------------------------

I've attached the diffs to the compiler source.

Andrew.


diff -u -r ./Makefile /tmp/compiler/Makefile
--- ./Makefile  2006-11-20 17:08:06.000000000 +0000
+++ /tmp/compiler/Makefile      2006-11-12 02:14:13.000000000 +0000
@@ -147,7 +147,7 @@
        $(JAVAC) -d $(BUILD_BOOTCLASSES) -source $(COMPILER_SOURCE_LEVEL) -g:source,lines @$(BUILD_JAVAC_SRCFILES)
        $(MKDIR) -p $(BUILD_CLASSES)
        $(JAVA) -cp $(BUILD_BOOTCLASSES):$(SRC_CLASSES) com.sun.tools.javac.Main \
-               -d $(BUILD_CLASSES) -source $(COMPILER_SOURCE_LEVEL) -target $(COMPILER_SOURCE_LEVEL) -g:source,lines @$(BUILD_JAVAC_SRCFILES)
+               -d $(BUILD_CLASSES) -g:source,lines @$(BUILD_JAVAC_SRCFILES)
        ( $(ECHO) "Main-Class: com.sun.tools.javac.Main" ; \
          $(ECHO) "Built-By: $$USER" ; \
          $(ECHO) "Built-At: `date`" ) > $(BUILD)/javac.MF
diff -u -r ./src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java /tmp/compiler/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
--- ./src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java  2006-11-21 15:49:46.000000000 +0000
+++ /tmp/compiler/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java   2006-11-12 01:46:10.000000000 +0000
@@ -71,6 +71,7 @@
 import java.net.MalformedURLException;

 import sun.misc.Service;
+import sun.misc.ServiceConfigurationError;

 /**
  * Objects of this class hold and manage the state needed to support
@@ -454,7 +455,7 @@
                         return ps;
                     } else
                         throw new NoSuchElementException();
-                } catch (Error e) {
+                } catch (ServiceConfigurationError e) {
                     log.error("proc.bad.config.file", e.getLocalizedMessage());
                     throw new Abort();
                 } catch (Throwable e) {
@@ -471,7 +472,7 @@
                         return  psi.processorIterator.hasNext();
                     else
                         return innerIter.hasNext() || psi.processorIterator.hasNext();
-                } catch (Error e) {
+                } catch (ServiceConfigurationError e) {
                     log.error("proc.bad.config.file", e.getLocalizedMessage());
                     throw new Abort();
                 } catch (Throwable e) {
@@ -1009,7 +1010,7 @@
            } catch (MalformedURLException ex) {
                throw new AssertionError(ex);
            }
-           catch (Error e) {
+           catch (ServiceProxy.ServiceConfigurationError e) {
                log.error("proc.bad.config.file", e.getLocalizedMessage());
                return true;
            }


[Index of Archives]     [Linux Kernel]     [Linux Cryptography]     [Fedora]     [Fedora Directory]     [Red Hat Development]

  Powered by Linux