From 950dbb684d60c12b21281f56337b365b86cb74f4 Mon Sep 17 00:00:00 2001 From: "pedemont%us.ibm.com" Date: Mon, 2 May 2005 16:30:03 +0000 Subject: [PATCH] Bug 291512 - Generate Java interface files using nsIInterfaceInfoManager. Fix some type handling as a result of this change. r=biesi, sr=darin, a=asa --- allmakefiles.sh | 2 +- config/config.mk | 4 - config/rules.mk | 43 - docshell/base/Makefile.in | 4 - .../webBrowser/nsIContextMenuListener.idl | 2 +- .../webBrowser/nsIContextMenuListener2.idl | 4 +- .../browser/webBrowser/nsITooltipListener.idl | 2 +- .../webBrowser/nsITooltipTextProvider.idl | 2 +- .../components/ui/progressDlg/Makefile.in | 4 - extensions/java/xpcom/Makefile.in | 20 +- extensions/java/xpcom/build/Makefile.in | 36 +- extensions/java/xpcom/nsJavaWrapper.cpp | 8 +- extensions/java/xpcom/nsJavaXPTCStub.cpp | 69 +- extensions/java/xpcom/nsJavaXPTCStub.h | 3 + extensions/java/xpcom/tests/Makefile.in | 38 +- extensions/java/xpcom/tests/TestArray.java | 26 +- extensions/java/xpcom/tests/TestParams.java | 239 ----- extensions/java/xpcom/tests/TestProps.java | 2 +- extensions/java/xpcom/tests/TestQI.java | 6 +- .../genifaces/GenerateJavaInterfaces.cpp | 851 ++++++++++++++++++ .../java/xpcom/tools/genifaces/Makefile.in | 64 ++ netwerk/mime/public/Makefile.in | 4 - uriloader/base/Makefile.in | 6 - uriloader/exthandler/Makefile.in | 5 - widget/public/Makefile.in | 5 - xpcom/ds/Makefile.in | 4 - xpcom/typelib/Makefile.in | 4 - 27 files changed, 1044 insertions(+), 413 deletions(-) create mode 100644 extensions/java/xpcom/tools/genifaces/GenerateJavaInterfaces.cpp create mode 100644 extensions/java/xpcom/tools/genifaces/Makefile.in diff --git a/allmakefiles.sh b/allmakefiles.sh index c77771d26ac..7371c3bc54f 100755 --- a/allmakefiles.sh +++ b/allmakefiles.sh @@ -1384,7 +1384,7 @@ for extension in $MOZ_EXTENSIONS; do extensions/java/xpcom/Makefile extensions/java/xpcom/build/Makefile extensions/java/xpcom/tests/Makefile - extensions/java/xpcom/tools/xpidl/Makefile + extensions/java/xpcom/tools/genifaces/Makefile " ;; typeaheadfind ) MAKEFILES_extensions="$MAKEFILES_extensions $MAKEFILES_typeaheadfind" diff --git a/config/config.mk b/config/config.mk index 3c3abdf4a0d..a83c20362dd 100644 --- a/config/config.mk +++ b/config/config.mk @@ -533,10 +533,6 @@ XPIDL_COMPILE = $(CYGWIN_WRAPPER) $(topsrcdir)/../tools/xpidl.exe XPIDL_LINK = $(CYGWIN_WRAPPER) $(topsrcdir)/../tools/xpt_link.exe endif -# Java macros -JAVA_IDL_COMPILE = $(CYGWIN_WRAPPER) $(DIST)/bin/java_xpidl$(BIN_SUFFIX) -JAVA_DIST_DIR = $(DIST)/java - REQ_INCLUDES = $(foreach d,$(REQUIRES),-I$(DIST)/include/$d) INCLUDES = $(LOCAL_INCLUDES) $(REQ_INCLUDES) -I$(PUBLIC) -I$(DIST)/include $(OS_INCLUDES) diff --git a/config/rules.mk b/config/rules.mk index 26a7091a4da..5b00b2d5e0a 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -565,12 +565,6 @@ endif endif endif -ifdef MOZ_ENABLE_JAVAXPCOM -JAVA_XPIDLSRCS += $(SDK_XPIDLSRCS) -else -JAVA_XPIDLSRCS = -endif - ################################################################################ # The root makefile doesn't want to do a plain export/libs, because @@ -1279,11 +1273,6 @@ $(SDK_PUBLIC) $(PUBLIC):: @if test ! -d $@; then echo Creating $@; rm -rf $@; $(NSINSTALL) -D $@; else true; fi endif -ifneq ($(JAVA_XPIDLSRCS),) -$(JAVA_DIST_DIR):: - @if test ! -d $@; then echo Creating $@; rm -rf $@; $(NSINSTALL) -D $@; else true; fi -endif - ifneq ($(XPI_NAME),) export:: @if test ! -d $(FINAL_TARGET); then echo Creating $(FINAL_TARGET); rm -fr $(FINAL_TARGET); $(NSINSTALL) -D $(FINAL_TARGET); else true; fi @@ -1531,38 +1520,6 @@ endif endif # SDK_XPIDLSRCS - - - -ifneq ($(JAVA_XPIDLSRCS),) - -# A single IDL file can contain multiple interfaces, which result in multiple -# Java interface files. So use hidden dependency files. -JAVADEPFILES = $(addprefix $(XPIDL_GEN_DIR)/org/mozilla/xpcom/.,$(JAVA_XPIDLSRCS:.idl=.java.pp)) - -# generate .java files into $(XPIDL_GEN_DIR) -$(XPIDL_GEN_DIR)/org/mozilla/xpcom/.done: $(XPIDL_GEN_DIR)/.done - @if test ! -d $(XPIDL_GEN_DIR)/org/mozilla/xpcom; then echo Creating $(XPIDL_GEN_DIR)/org/mozilla/xpcom/.done; rm -rf $(XPIDL_GEN_DIR)/org; mkdir $(XPIDL_GEN_DIR)/org; mkdir $(XPIDL_GEN_DIR)/org/mozilla; mkdir $(XPIDL_GEN_DIR)/org/mozilla/xpcom; fi - @touch $@ - -$(XPIDL_GEN_DIR)/org/mozilla/xpcom/.%.java.pp: %.idl $(JAVA_IDL_COMPILE) $(XPIDL_GEN_DIR)/org/mozilla/xpcom/.done - $(REPORT_BUILD) - $(ELOG) $(JAVA_IDL_COMPILE) -m java -p org.mozilla.xpcom -w -I$(srcdir) -I$(IDL_DIR) -o $(XPIDL_GEN_DIR)/org/mozilla/xpcom/$* $(_VPATH_SRCS) - @touch $@ - - -export:: $(JAVA_DIST_DIR) - -# Use a wildcard to install the generated Java files since there is no strict -# one-to-one mapping between IDL files and Java files (IDL files can have -# multiple interfaces). -export:: $(JAVADEPFILES) -ifndef NO_DIST_INSTALL - $(INSTALL) $(IFLAGS1) $(XPIDL_GEN_DIR)/org/mozilla/xpcom/*.java $(JAVA_DIST_DIR)/org/mozilla/xpcom/ -endif - -endif # JAVA_XPIDLSRCS - ################################################################################ # Copy each element of EXTRA_COMPONENTS to $(FINAL_TARGET)/components ifdef EXTRA_COMPONENTS diff --git a/docshell/base/Makefile.in b/docshell/base/Makefile.in index da57a598082..248079c6ab9 100644 --- a/docshell/base/Makefile.in +++ b/docshell/base/Makefile.in @@ -89,10 +89,6 @@ SDK_XPIDLSRCS = \ nsIGlobalHistory.idl \ $(NULL) -JAVA_XPIDLSRCS = \ - nsIWebNavigation.idl \ - $(NULL) - XPIDLSRCS = \ nsCDocShell.idl \ nsCDefaultURIFixup.idl \ diff --git a/embedding/browser/webBrowser/nsIContextMenuListener.idl b/embedding/browser/webBrowser/nsIContextMenuListener.idl index 704b1cc6b90..35b6da95dc4 100644 --- a/embedding/browser/webBrowser/nsIContextMenuListener.idl +++ b/embedding/browser/webBrowser/nsIContextMenuListener.idl @@ -54,7 +54,7 @@ interface nsIDOMNode; * * @status FROZEN */ -[uuid(3478b6b0-3875-11d4-94ef-0020183bf181)] +[scriptable, uuid(3478b6b0-3875-11d4-94ef-0020183bf181)] interface nsIContextMenuListener : nsISupports { /** Flag. No context. */ diff --git a/embedding/browser/webBrowser/nsIContextMenuListener2.idl b/embedding/browser/webBrowser/nsIContextMenuListener2.idl index d6487f9c036..786f7f046b7 100644 --- a/embedding/browser/webBrowser/nsIContextMenuListener2.idl +++ b/embedding/browser/webBrowser/nsIContextMenuListener2.idl @@ -60,7 +60,7 @@ interface nsIContextMenuInfo; * @status UNDER_REVIEW */ -[uuid(7fb719b3-d804-4964-9596-77cf924ee314)] +[scriptable, uuid(7fb719b3-d804-4964-9596-77cf924ee314)] interface nsIContextMenuListener2 : nsISupports { /** Flag. No context. */ @@ -113,7 +113,7 @@ interface nsIContextMenuListener2 : nsISupports * @status UNDER_REVIEW */ -[uuid(2f977d56-5485-11d4-87e2-0010a4e75ef2)] +[scriptable, uuid(2f977d56-5485-11d4-87e2-0010a4e75ef2)] interface nsIContextMenuInfo : nsISupports { /** diff --git a/embedding/browser/webBrowser/nsITooltipListener.idl b/embedding/browser/webBrowser/nsITooltipListener.idl index f7614090c91..42cbeb7ae02 100644 --- a/embedding/browser/webBrowser/nsITooltipListener.idl +++ b/embedding/browser/webBrowser/nsITooltipListener.idl @@ -50,7 +50,7 @@ * * @status FROZEN */ -[uuid(44b78386-1dd2-11b2-9ad2-e4eee2ca1916)] +[scriptable, uuid(44b78386-1dd2-11b2-9ad2-e4eee2ca1916)] interface nsITooltipListener : nsISupports { /** diff --git a/embedding/browser/webBrowser/nsITooltipTextProvider.idl b/embedding/browser/webBrowser/nsITooltipTextProvider.idl index d4b43a074bc..211fddfdc59 100644 --- a/embedding/browser/webBrowser/nsITooltipTextProvider.idl +++ b/embedding/browser/webBrowser/nsITooltipTextProvider.idl @@ -61,7 +61,7 @@ interface nsIDOMNode; * * @status FROZEN */ -[uuid(b128a1e6-44f3-4331-8fbe-5af360ff21ee)] +[scriptable, uuid(b128a1e6-44f3-4331-8fbe-5af360ff21ee)] interface nsITooltipTextProvider : nsISupports { /** diff --git a/embedding/components/ui/progressDlg/Makefile.in b/embedding/components/ui/progressDlg/Makefile.in index 562c58d4aed..a4561e3d101 100644 --- a/embedding/components/ui/progressDlg/Makefile.in +++ b/embedding/components/ui/progressDlg/Makefile.in @@ -45,10 +45,6 @@ include $(DEPTH)/config/autoconf.mk MODULE = progressDlg XPIDL_MODULE = progressDlg -JAVA_XPIDLSRCS = \ - nsIProgressDialog.idl \ - $(NULL) - XPIDLSRCS = \ nsIProgressDialog.idl \ $(NULL) diff --git a/extensions/java/xpcom/Makefile.in b/extensions/java/xpcom/Makefile.in index 314eb4badbd..acd596e5f3f 100644 --- a/extensions/java/xpcom/Makefile.in +++ b/extensions/java/xpcom/Makefile.in @@ -56,7 +56,7 @@ REQUIRES = xpcom \ embed_base \ $(NULL) -DIRS = build +DIRS = tools/genifaces build CPPSRCS = \ nsAppFileLocProviderProxy.cpp \ @@ -67,19 +67,6 @@ CPPSRCS = \ nsJavaXPCOMBindingUtils.cpp \ $(NULL) -JAVA_SRCS = \ - XPCOM.java \ - XPCOMJavaProxy.java \ - XPCOMJavaProxyBase.java \ - XPCOMException.java \ - GeckoEmbed.java \ - AppFileLocProvider.java \ - $(NULL) - -GEN_JAVA_SRCS = \ - XPCOMError.java \ - $(NULL) - LOCAL_INCLUDES = -I$(JAVA_INCLUDE_PATH) ifeq ($(OS_ARCH),WINNT) @@ -103,7 +90,4 @@ include $(topsrcdir)/config/rules.mk XPCOMError.java: $(topsrcdir)/xpcom/base/nsError.h gen-nsError.pl Makefile Makefile.in $(PERL) $(srcdir)/gen-nsError.pl < $< > $@ -export:: $(GEN_JAVA_SRCS) - @$(INSTALL) -m 644 $(addprefix $(srcdir)/,$(JAVA_SRCS)) $(JAVA_DIST_DIR)/org/mozilla/xpcom - @$(INSTALL) -m 644 $(GEN_JAVA_SRCS) $(JAVA_DIST_DIR)/org/mozilla/xpcom - +export:: XPCOMError.java diff --git a/extensions/java/xpcom/build/Makefile.in b/extensions/java/xpcom/build/Makefile.in index 3a606728a98..1eac43ab794 100644 --- a/extensions/java/xpcom/build/Makefile.in +++ b/extensions/java/xpcom/build/Makefile.in @@ -47,7 +47,20 @@ JARFILE = mozjava.jar JARFILE_SRC = $(patsubst %.jar,%-src.jar,$(JARFILE)) GARBAGE += $(JARFILE) $(JARFILE_SRC) -GARBAGE_DIRS += org +GARBAGE_DIRS += _javagen org + +JAVA_SRCS = \ + XPCOM.java \ + XPCOMJavaProxy.java \ + XPCOMJavaProxyBase.java \ + XPCOMException.java \ + GeckoEmbed.java \ + AppFileLocProvider.java \ + $(NULL) + +GEN_JAVA_SRCS = \ + XPCOMError.java \ + $(NULL) include $(topsrcdir)/config/rules.mk @@ -55,16 +68,31 @@ ifdef MOZ_DEBUG JAVAC_FLAGS = -g endif -org/mozilla/xpcom/.class_done: +_javagen/org/mozilla/xpcom/.iface_done: + @if test ! -d _javagen/org/mozilla/xpcom; then \ + touch .done; \ + $(INSTALL) -m 644 .done _javagen/org/mozilla/xpcom; \ + fi + @echo Copying Java source files + @$(INSTALL) -m 644 $(addprefix $(srcdir)/../,$(JAVA_SRCS)) \ + _javagen/org/mozilla/xpcom + @$(INSTALL) -m 644 $(addprefix ../,$(GEN_JAVA_SRCS)) \ + _javagen/org/mozilla/xpcom + @echo Generating Java interface files + $(DIST)/bin/run-mozilla.sh $(DIST)/bin/GenerateJavaInterfaces$(BIN_SUFFIX) \ + -d $(CURDIR)/_javagen/org/mozilla/xpcom + @touch $@ + +org/mozilla/xpcom/.class_done: _javagen/org/mozilla/xpcom/.iface_done @echo Compiling Java interface classes - @$(JAVAC) $(JAVAC_FLAGS) -classpath . -d . $(JAVA_DIST_DIR)/org/mozilla/xpcom/*.java + @$(JAVAC) $(JAVAC_FLAGS) -classpath . -d . _javagen/org/mozilla/xpcom/*.java @touch $@ $(JARFILE): org/mozilla/xpcom/.class_done Makefile $(JAR) cf $@ org $(JARFILE_SRC): $(JARFILE) - $(JAR) cf $@ -C $(JAVA_DIST_DIR) org + $(JAR) cf $@ -C _javagen org libs:: $(JARFILE) $(JARFILE_SRC) $(INSTALL) $(IFLAGS1) $^ $(DIST)/bin diff --git a/extensions/java/xpcom/nsJavaWrapper.cpp b/extensions/java/xpcom/nsJavaWrapper.cpp index 097ea04e8e2..90f06289336 100644 --- a/extensions/java/xpcom/nsJavaWrapper.cpp +++ b/extensions/java/xpcom/nsJavaWrapper.cpp @@ -1436,8 +1436,8 @@ JAVAPROXY_NATIVE(callXPCOMMethod) (JNIEnv *env, jclass that, jobject aJavaProxy, PRUint8 type = params[i].type.TagPart(); // is paramater an array? - PRUint8 arrayType; - PRUint32 arraySize; + PRUint8 arrayType = 0; + PRUint32 arraySize = 0; if (type == nsXPTType::T_ARRAY) { // get array type nsXPTType xpttype; @@ -1530,8 +1530,8 @@ JAVAPROXY_NATIVE(callXPCOMMethod) (JNIEnv *env, jclass that, jobject aJavaProxy, PRUint8 type = paramInfo.GetType().TagPart(); // is paramater an array? - PRUint8 arrayType; - PRUint32 arraySize; + PRUint8 arrayType = 0; + PRUint32 arraySize = 0; if (type == nsXPTType::T_ARRAY) { // get array type nsXPTType array_xpttype; diff --git a/extensions/java/xpcom/nsJavaXPTCStub.cpp b/extensions/java/xpcom/nsJavaXPTCStub.cpp index ce31bdfb2f4..1dc568f543a 100644 --- a/extensions/java/xpcom/nsJavaXPTCStub.cpp +++ b/extensions/java/xpcom/nsJavaXPTCStub.cpp @@ -411,7 +411,8 @@ nsJavaXPTCStub::CallMethod(PRUint16 aMethodIndex, methodSig.Append(')'); if (retvalInfo) { nsCAutoString retvalSig; - rv = GetRetvalSig(retvalInfo, retvalSig); + rv = GetRetvalSig(retvalInfo, aMethodInfo, aMethodIndex, aParams, + retvalSig); methodSig.Append(retvalSig); } else { methodSig.Append('V'); @@ -885,15 +886,22 @@ nsJavaXPTCStub::SetupJavaParams(const nsXPTParamInfo &aParamInfo, xpcom_obj = *variant; } + nsID iid; + rv = GetIIDForMethodParam(mIInfo, aMethodInfo, aParamInfo, + aParamInfo.GetType().TagPart(), aMethodIndex, + aDispatchParams, PR_FALSE, iid); + if (NS_FAILED(rv)) + break; + + // get name of interface + char* iface_name = nsnull; + nsCOMPtr iim = XPTI_GetInterfaceInfoManager(); + rv = iim->GetNameForIID(&iid, &iface_name); + if (NS_FAILED(rv) || !iface_name) + break; + jobject java_stub = nsnull; if (xpcom_obj) { - nsID iid; - rv = GetIIDForMethodParam(mIInfo, aMethodInfo, aParamInfo, - aParamInfo.GetType().TagPart(), aMethodIndex, - aDispatchParams, PR_FALSE, iid); - if (NS_FAILED(rv)) - break; - // Get matching Java object for given xpcom object rv = GetNewOrUsedJavaObject(mJavaEnv, xpcom_obj, iid, &java_stub); if (NS_FAILED(rv)) @@ -902,7 +910,6 @@ nsJavaXPTCStub::SetupJavaParams(const nsXPTParamInfo &aParamInfo, if (!aParamInfo.IsOut()) { // 'in' aJValue.l = java_stub; - aMethodSig.AppendLiteral("Lorg/mozilla/xpcom/nsISupports;"); } else { // 'inout' & 'out' if (aVariant.val.p) { aJValue.l = mJavaEnv->NewObjectArray(1, nsISupportsClass, java_stub); @@ -913,8 +920,18 @@ nsJavaXPTCStub::SetupJavaParams(const nsXPTParamInfo &aParamInfo, } else { aJValue.l = nsnull; } - aMethodSig.AppendLiteral("[Lorg/mozilla/xpcom/nsISupports;"); + aMethodSig.Append('['); } + + if (tag != nsXPTType::T_INTERFACE_IS) { + aMethodSig.AppendLiteral("Lorg/mozilla/xpcom/"); + aMethodSig.AppendASCII(iface_name); + aMethodSig.Append(';'); + } else { + aMethodSig.AppendLiteral("Lorg/mozilla/xpcom/nsISupports;"); + } + + nsMemory::Free(iface_name); } break; @@ -1039,11 +1056,13 @@ nsJavaXPTCStub::SetupJavaParams(const nsXPTParamInfo &aParamInfo, nsresult nsJavaXPTCStub::GetRetvalSig(const nsXPTParamInfo* aParamInfo, - nsACString &aRetvalSig) + const nsXPTMethodInfo* aMethodInfo, + PRUint16 aMethodIndex, + nsXPTCMiniVariant* aDispatchParams, + nsACString &aRetvalSig) { - const nsXPTType &type = aParamInfo->GetType(); - PRUint8 tag = type.TagPart(); - switch (tag) + PRUint8 type = aParamInfo->GetType().TagPart(); + switch (type) { case nsXPTType::T_I8: aRetvalSig.Append('B'); @@ -1093,6 +1112,28 @@ nsJavaXPTCStub::GetRetvalSig(const nsXPTParamInfo* aParamInfo, break; case nsXPTType::T_INTERFACE: + { + nsID iid; + nsresult rv = GetIIDForMethodParam(mIInfo, aMethodInfo, *aParamInfo, type, + aMethodIndex, aDispatchParams, + PR_FALSE, iid); + if (NS_FAILED(rv)) + break; + + // get name of interface + char* iface_name = nsnull; + nsCOMPtr iim = XPTI_GetInterfaceInfoManager(); + rv = iim->GetNameForIID(&iid, &iface_name); + if (NS_FAILED(rv) || !iface_name) + break; + + aRetvalSig.AppendLiteral("Lorg/mozilla/xpcom/"); + aRetvalSig.AppendASCII(iface_name); + aRetvalSig.Append(';'); + nsMemory::Free(iface_name); + break; + } + case nsXPTType::T_INTERFACE_IS: aRetvalSig.AppendLiteral("Lorg/mozilla/xpcom/nsISupports;"); break; diff --git a/extensions/java/xpcom/nsJavaXPTCStub.h b/extensions/java/xpcom/nsJavaXPTCStub.h index e53e2c5d8f6..d0f4fa2ebb5 100644 --- a/extensions/java/xpcom/nsJavaXPTCStub.h +++ b/extensions/java/xpcom/nsJavaXPTCStub.h @@ -108,6 +108,9 @@ private: nsXPTCMiniVariant &aVariant, jvalue &aJValue, nsACString &aMethodSig); nsresult GetRetvalSig(const nsXPTParamInfo* aParamInfo, + const nsXPTMethodInfo* aMethodInfo, + PRUint16 aMethodIndex, + nsXPTCMiniVariant* aDispatchParams, nsACString &aRetvalSig); nsresult FinalizeJavaParams(const nsXPTParamInfo &aParamInfo, const nsXPTMethodInfo* aMethodInfo, diff --git a/extensions/java/xpcom/tests/Makefile.in b/extensions/java/xpcom/tests/Makefile.in index 0c14a746040..2c80f53b047 100644 --- a/extensions/java/xpcom/tests/Makefile.in +++ b/extensions/java/xpcom/tests/Makefile.in @@ -51,20 +51,8 @@ XPIDLSRCS = \ ITestParams.idl \ $(NULL) -# Since we are creating a component that implements the ITestParams interface -# (in the 'dll' directory), we need to add the Java interface to the -# org.mozilla.xpcom package. -JAVA_XPIDLSRCS += \ - ITestParams.idl \ - $(NULL) - -# The IFoo interface is not part of the org.mozilla.xpcom package, but we need -# to create a Java version of it. -LOCAL_JAVA_XPIDLSRCS = \ - IFoo.idl \ - $(NULL) - JAVA_SRCS = \ + Foo.java \ TestArray.java \ TestProps.java \ TestQI.java \ @@ -80,28 +68,22 @@ else SEP = : endif -JAVA_CLASSPATH = ./../build$(SEP)$(XPIDL_GEN_DIR) +_JAVA_CLASSPATH = .$(SEP)./../build$(SEP)$(XPIDL_GEN_DIR) -GARBAGE += *.class +REBUILD_JAR = .rebuild_jar + +GARBAGE += *.class $(REBUILD_JAR) include $(topsrcdir)/config/rules.mk -$(XPIDL_GEN_DIR)/%.java: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done - $(REPORT_BUILD) - $(ELOG) $(JAVA_IDL_COMPILE) -m java -w -I$(srcdir) -I$(IDL_DIR) \ - -o $(XPIDL_GEN_DIR)/$* $(_VPATH_SRCS) - -ifdef JAVA_CLASSPATH -_JAVA_CLASSPATH = .$(SEP)$(srcdir)$(SEP)$(JAVA_CLASSPATH) -else -_JAVA_CLASSPATH = .$(SEP)$(srcdir) -endif - %.class: %.java Makefile Makefile.in $(REPORT_BUILD) $(ELOG) $(CYGWIN_WRAPPER) $(JAVAC) -classpath $(_JAVA_CLASSPATH) -d . \ $(_VPATH_SRCS) -export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.java, $(LOCAL_JAVA_XPIDLSRCS)) +# make sure to rebuild Java interfaces if our XPIDLSRCS change +$(REBUILD_JAR): $(XPIDLSRCS) + @cd ../build; make clean; make + @touch $@ -libs:: $(JAVA_SRCS:.java=.class) +libs:: $(REBUILD_JAR) $(JAVA_SRCS:.java=.class) diff --git a/extensions/java/xpcom/tests/TestArray.java b/extensions/java/xpcom/tests/TestArray.java index 8d6805658cc..e7d938f5afe 100644 --- a/extensions/java/xpcom/tests/TestArray.java +++ b/extensions/java/xpcom/tests/TestArray.java @@ -108,7 +108,7 @@ public class TestArray { // test IndexOf && LastIndexOf int expectedIndex[] = {0, 4, 6, 12, -1}; int count = 0; - int index = array.indexOf(0, foo); + long index = array.indexOf(0, foo); System.out.println("IndexOf(foo): " + index + "=" + expectedIndex[count] + " " + assertEqual(index, expectedIndex[count])); try { @@ -193,7 +193,7 @@ public class TestArray { } } - static String assertEqual(int aValue1, int aValue2) + static String assertEqual(long aValue1, long aValue2) { if (aValue1 == aValue2) return "OK"; @@ -203,7 +203,7 @@ public class TestArray { static void dumpArray(nsIMutableArray aArray, int aExpectedCount, int[] aElementIDs, int aExpectedTotal) { - int count = 0; + long count = 0; if (aArray != null) count = aArray.getLength(); @@ -214,17 +214,17 @@ public class TestArray { for (int index = 0; (index < count) && (index < aExpectedCount); index++) { IFoo foo = (IFoo) aArray.queryElementAt(index, IFoo.IFOO_IID); - System.out.println(index + ": " + aElementIDs[index] + "=" + - foo.getId() + " (" + - Integer.toHexString(foo.hashCode()) + ") " + - assertEqual(foo.getId(), aElementIDs[index])); - foo = null; - } + System.out.println(index + ": " + aElementIDs[index] + "=" + + foo.getId() + " (" + + Integer.toHexString(foo.hashCode()) + ") " + + assertEqual(foo.getId(), aElementIDs[index])); + foo = null; + } } - static int lastIndexOf(nsIMutableArray aArray, nsISupports aElement) + static long lastIndexOf(nsIMutableArray aArray, nsISupports aElement) { - for (int i = aArray.getLength() - 1; i >= 0; i--) { + for (long i = aArray.getLength() - 1; i >= 0; i--) { IFoo foo = (IFoo) aArray.queryElementAt(i, IFoo.IFOO_IID); if (foo == aElement) return i; @@ -242,13 +242,13 @@ public class TestArray { /* Removes first instance of given element */ static void removeElement(nsIMutableArray aArray, nsISupports aElement) { - int index = aArray.indexOf(0, aElement); + long index = aArray.indexOf(0, aElement); aArray.removeElementAt(index); } static void removeLastElement(nsIMutableArray aArray, nsISupports aElement) { - int index = lastIndexOf(aArray, aElement); + long index = lastIndexOf(aArray, aElement); aArray.removeElementAt(index); } } diff --git a/extensions/java/xpcom/tests/TestParams.java b/extensions/java/xpcom/tests/TestParams.java index 0575f119a4e..e69de29bb2d 100644 --- a/extensions/java/xpcom/tests/TestParams.java +++ b/extensions/java/xpcom/tests/TestParams.java @@ -1,239 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Java XPCOM Bindings. - * - * The Initial Developer of the Original Code is - * IBM Corporation. - * Portions created by the Initial Developer are Copyright (C) 2005 - * IBM Corporation. All Rights Reserved. - * - * Contributor(s): - * Javier Pedemonte (jhpedemonte@gmail.com) - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -import org.mozilla.xpcom.*; -import java.io.*; - - -public class TestParams -{ - public static final String TESTPARAMS_CID = - "{3f64f1ad-bbbc-4c2f-88c8-e5b6b67bb0cc}"; - - public static void main(String [] args) - { - System.loadLibrary("javaxpcom"); - - String mozillaPath = System.getProperty("MOZILLA_FIVE_HOME"); - if (mozillaPath == null) { - throw new RuntimeException("MOZILLA_FIVE_HOME system property not set."); - } - - File localFile = new File(mozillaPath); - XPCOM.initXPCOM(localFile, null); - - nsIComponentManager componentManager = XPCOM.getComponentManager(); - ITestParams p = (ITestParams) - componentManager.createInstance(TESTPARAMS_CID, null, - ITestParams.ITESTPARAMS_IID); - if (p == null) { - throw new RuntimeException("Failed to create ITestParams."); - } - - testArrayParams(p); - - XPCOM.shutdownXPCOM(null); - } - - static void testArrayParams(ITestParams p) - { - testArrayParamsIn(p); - testArrayParamsOut(p); - testArrayParamsInOut(p); - testArrayParamsRetval(p); - } - - static void testArrayParamsIn(ITestParams p) - { - int count = 4; - byte[] byte_array = new byte[count]; - for (byte i = 0; i < count; i++) { - byte_array[i] = i; - } - p.testSimpleTypeArrayIn(count, byte_array); - - count = 3; - String[] str_array = new String[count]; - str_array[0] = "three"; - str_array[1] = "two"; - str_array[2] = "one"; - p.testCharStrTypeArrayIn(count, str_array); - - count = 4; - str_array = new String[count]; - str_array[0] = "foúr"; - str_array[1] = "threë"; - str_array[2] = "twò"; - str_array[3] = "ône"; - p.testWCharStrTypeArrayIn(count, str_array); - - count = 2; - String[] iid_array = new String[count]; - iid_array[0] = nsISupports.NS_ISUPPORTS_IID; - iid_array[1] = nsISupportsWeakReference.NS_ISUPPORTSWEAKREFERENCE_IID; - p.testIIDTypeArrayIn(count, iid_array); - - count = 3; - nsILocalFile[] iface_array = new nsILocalFile[count]; - iface_array[0] = XPCOM.newLocalFile("/usr/bin", false); - iface_array[1] = XPCOM.newLocalFile("/var/log", false); - iface_array[2] = XPCOM.newLocalFile("/home", false); - p.testIfaceTypeArrayIn(count, iface_array); - } - - static void testArrayParamsOut(ITestParams p) - { - int[] count = new int[1]; - char[][] char_array = new char[1][]; - p.testSimpleTypeArrayOut(count, char_array); - for (int i = 0; i < count[0]; i++) { - System.out.println("[" + i + "] " + char_array[0][i]); - } - - String[][] str_array = new String[1][]; - p.testCharStrTypeArrayOut(count, str_array); - for (int i = 0; i < count[0]; i++) { - System.out.println("[" + i + "] " + str_array[0][i]); - } - - str_array = new String[1][]; - p.testWCharStrTypeArrayOut(count, str_array); - for (int i = 0; i < count[0]; i++) { - System.out.println("[" + i + "] " + str_array[0][i]); - } - - str_array = new String[1][]; - p.testIIDTypeArrayOut(count, str_array); - for (int i = 0; i < count[0]; i++) { - System.out.println("[" + i + "] " + str_array[0][i]); - } - - nsILocalFile[][] file_array = new nsILocalFile[1][]; - p.testIfaceTypeArrayOut(count, file_array); - for (int i = 0; i < count[0]; i++) { - System.out.println("[" + i + "] " + file_array[0][i].getPath()); - } - } - - static void testArrayParamsInOut(ITestParams p) - { - int count = 5; - short[][] short_array = new short[1][count]; - for (short i = 0; i < count; i++) { - short_array[0][i] = i; - } - p.testSimpleTypeArrayInOut(count, short_array); - System.out.println("out:"); - for (int i = 0; i < count; i++) { - System.out.println("[" + i + "] " + short_array[0][i]); - } - - count = 3; - String[][] str_array = new String[1][count]; - str_array[0][0] = "three"; - str_array[0][1] = "two"; - str_array[0][2] = "one"; - p.testCharStrTypeArrayInOut(count, str_array); - System.out.println("out:"); - for (int i = 0; i < count; i++) { - System.out.println("[" + i + "] " + str_array[0][i]); - } - - count = 4; - str_array = new String[1][count]; - str_array[0][0] = "foúr"; - str_array[0][1] = "threë"; - str_array[0][2] = "twò"; - str_array[0][3] = "ône"; - p.testWCharStrTypeArrayInOut(count, str_array); - System.out.println("out:"); - for (int i = 0; i < count; i++) { - System.out.println("[" + i + "] " + str_array[0][i]); - } - - count = 2; - String[][] iid_array = new String[1][count]; - iid_array[0][0] = nsISupports.NS_ISUPPORTS_IID; - iid_array[0][1] = nsISupportsWeakReference.NS_ISUPPORTSWEAKREFERENCE_IID; - p.testIIDTypeArrayInOut(count, iid_array); - System.out.println("out:"); - for (int i = 0; i < count; i++) { - System.out.println("[" + i + "] " + iid_array[0][i]); - } - - count = 3; - nsILocalFile[][] iface_array = new nsILocalFile[1][count]; - iface_array[0][0] = XPCOM.newLocalFile("/usr/bin", false); - iface_array[0][1] = XPCOM.newLocalFile("/var/log", false); - iface_array[0][2] = XPCOM.newLocalFile("/home", false); - p.testIfaceTypeArrayInOut(count, iface_array); - System.out.println("out:"); - for (int i = 0; i < count; i++) { - System.out.println("[" + i + "] " + iface_array[0][i].getPath()); - } - } - - static void testArrayParamsRetval(ITestParams p) - { - int[] count = new int[1]; - int[] int_array = p.returnSimpleTypeArray(count); - for (int i = 0; i < count[0]; i++) { - System.out.println("[" + i + "] " + int_array[i]); - } - - String[] str_array = p.returnCharStrTypeArray(count); - for (int i = 0; i < count[0]; i++) { - System.out.println("[" + i + "] " + str_array[i]); - } - - str_array = p.returnWCharStrTypeArray(count); - for (int i = 0; i < count[0]; i++) { - System.out.println("[" + i + "] " + str_array[i]); - } - - str_array = p.returnIIDTypeArray(count); - for (int i = 0; i < count[0]; i++) { - System.out.println("[" + i + "] " + str_array[i]); - } - - nsILocalFile[] file_array = (nsILocalFile[]) p.returnIfaceTypeArray(count); - for (int i = 0; i < count[0]; i++) { - System.out.println("[" + i + "] " + file_array[i].getPath()); - } - } -} - diff --git a/extensions/java/xpcom/tests/TestProps.java b/extensions/java/xpcom/tests/TestProps.java index e45b94f9b21..c33c958e0b4 100644 --- a/extensions/java/xpcom/tests/TestProps.java +++ b/extensions/java/xpcom/tests/TestProps.java @@ -111,7 +111,7 @@ public class TestProps { throw new NoSuchElementException(); // test the "getKeys" method - int[] count = new int[1]; + long[] count = new long[1]; String[] keys = props.getKeys(count); if (keys == null || keys.length != 3) { System.out.println("getKeys returned incorrect array."); diff --git a/extensions/java/xpcom/tests/TestQI.java b/extensions/java/xpcom/tests/TestQI.java index a692d32973b..d4e38689952 100644 --- a/extensions/java/xpcom/tests/TestQI.java +++ b/extensions/java/xpcom/tests/TestQI.java @@ -91,7 +91,7 @@ public class TestQI { /** - * Dummy class that implements nsIFileUrl. The inheritance chaing for + * Dummy class that implements nsIFileUrl. The inheritance chain for * nsIFileURL is as follows: *
  *   nsIFileURL -> nsIURL -> nsIURI -> nsISupports
@@ -109,11 +109,11 @@ class FooFile implements nsIFileURL {
       return XPCOM.queryInterface(this, aIID);
   }
 
-	public nsISupports getFile() {
+	public nsIFile getFile() {
 		return null;
 	}
 
-	public void setFile(nsISupports aFile) {
+	public void setFile(nsIFile aFile) {
 	}
 
 	public String getFilePath() {
diff --git a/extensions/java/xpcom/tools/genifaces/GenerateJavaInterfaces.cpp b/extensions/java/xpcom/tools/genifaces/GenerateJavaInterfaces.cpp
new file mode 100644
index 00000000000..1fabde89d92
--- /dev/null
+++ b/extensions/java/xpcom/tools/genifaces/GenerateJavaInterfaces.cpp
@@ -0,0 +1,851 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Java XPCOM Bindings.
+ *
+ * The Initial Developer of the Original Code is
+ * IBM Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * IBM Corporation. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Javier Pedemonte (jhpedemonte@gmail.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsXPCOM.h"
+#include "nsString.h"
+#include "nsLocalFile.h"
+#include "nsIInterfaceInfoManager.h"
+#include "xptinfo.h"
+#include "nsCOMPtr.h"
+#include "prmem.h"
+#include "xptcall.h"
+#include "nsNetUtil.h"
+#include "nsHashSets.h"
+#include "nsIWeakReference.h"
+#include 
+
+#define WRITE_NOSCRIPT_METHODS
+
+
+class TypeInfo
+{
+public:
+  static nsresult GetParentInfo(nsIInterfaceInfo* aIInfo,
+                                nsIInterfaceInfo** aParentInfo,
+                                PRUint16* aParentMethodCount,
+                                PRUint16* aParentConstCount)
+  {
+    nsCOMPtr parent;
+    nsresult rv = aIInfo->GetParent(getter_AddRefs(parent));
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    if (!parent) {
+      *aParentInfo = nsnull;
+      *aParentMethodCount = 0;
+      return NS_OK;
+    }
+
+    rv = parent->GetMethodCount(aParentMethodCount);
+    NS_ENSURE_SUCCESS(rv, rv);
+    rv = parent->GetConstantCount(aParentConstCount);
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    *aParentInfo = parent;
+    NS_ADDREF(*aParentInfo);
+    return rv;
+  }
+
+  static nsresult GetInterfaceName(nsIInterfaceInfo* aIInfo,
+                                   PRUint16 aMethodIndex,
+                                   const nsXPTParamInfo* aParamInfo,
+                                   char** aResult)
+  {
+    static const char isupp_str[] = "nsISupports";
+
+    nsIID* iid;
+    nsresult rv = aIInfo->GetIIDForParam(aMethodIndex, aParamInfo, &iid);
+    if (NS_FAILED(rv)) {
+      // GetIIDForParam will sometimes fail to find an interface, particularly
+      // if that interface is not defined in an IDL file.  In those cases, just
+      // return |nsISupports|.
+      //
+      // For example, the |onStreamComplete| method for the interface
+      // |nsIUnicharStreamLoaderObserver| takes a param of
+      // |nsIUnicharInputStream|, which is defined in a simple header file, not
+      // an IDL file.
+      *aResult = (char*) nsMemory::Clone(isupp_str, sizeof(isupp_str));
+      rv = (*aResult == nsnull) ? NS_ERROR_OUT_OF_MEMORY : NS_OK;
+
+    } else {
+
+      // In Javaconnect, we handle weak references internally; no need for the
+      // |nsIWeakReference| interface.  So just return |nsISupports|.
+      if (iid->Equals(NS_GET_IID(nsIWeakReference))) {
+        *aResult = (char*) nsMemory::Clone(isupp_str, sizeof(isupp_str));
+        rv = (*aResult == nsnull) ? NS_ERROR_OUT_OF_MEMORY : NS_OK;
+
+      } else {
+
+        // Some methods take parameters of non-scriptable interfaces.  But we
+        // only output scriptable interfaces.  So if one of the param types is
+        // a non-scriptable interface, output |nsISupports| instead of the
+        // interface name.
+        nsCOMPtr info;
+        nsCOMPtr iim = XPTI_GetInterfaceInfoManager();
+        NS_ASSERTION(iim, "could not get interface info manager");
+        rv = iim->GetInfoForIID(iid, getter_AddRefs(info));
+        NS_ENSURE_SUCCESS(rv, rv);
+        PRBool scriptable;
+        if (NS_SUCCEEDED(rv)) {
+          info->IsScriptable(&scriptable);
+        }
+        if (NS_FAILED(rv) || !scriptable) {
+          *aResult = (char*) nsMemory::Clone(isupp_str, sizeof(isupp_str));
+          rv = (*aResult == nsnull) ? NS_ERROR_OUT_OF_MEMORY : NS_OK;
+        } else {
+
+          // If is scriptable, get name for given IID
+          rv = iim->GetNameForIID(iid, aResult);
+        }
+      }
+
+      nsMemory::Free(iid);
+    }
+
+    return rv;
+  }
+};
+
+
+static const char* kJavaKeywords[] = {
+  "abstract", "default", "if"        , "private"     , "this"     ,
+  "boolean" , "do"     , "implements", "protected"   , "throw"    ,
+  "break"   , "double" , "import",     "public"      , "throws"   ,
+  "byte"    , "else"   , "instanceof", "return"      , "transient",
+  "case"    , "extends", "int"       , "short"       , "try"      ,
+  "catch"   , "final"  , "interface" , "static"      , "void"     ,
+  "char"    , "finally", "long"      , "strictfp"    , "volatile" ,
+  "class"   , "float"  , "native"    , "super"       , "while"    ,
+  "const"   , "for"    , "new"       , "switch"      ,
+  "continue", "goto"   , "package"   , "synchronized",
+  "assert"  ,  /* added in Java 1.4 */
+  "enum"    ,  /* added in Java 5.0 */
+  "clone"   ,  /* clone is a member function of java.lang.Object */
+  "finalize"   /* finalize is a member function of java.lang.Object */
+};
+
+#ifdef WRITE_NOSCRIPT_METHODS
+// SWT uses [noscript] methods of the following interfaces, so we need to
+// output the [noscript] methods for these interfaces.
+static const char* kNoscriptMethodIfaces[] = {
+  "nsIBaseWindow", "nsIEmbeddingSiteWindow"
+};
+#endif
+
+
+class Generate
+{
+  nsILocalFile*     mOutputDir;
+  nsCStringHashSet  mIfaceTable;
+  nsCStringHashSet  mJavaKeywords;
+#ifdef WRITE_NOSCRIPT_METHODS
+  nsCStringHashSet  mNoscriptMethodsTable;
+#endif
+
+public:
+  Generate(nsILocalFile* aOutputDir)
+    : mOutputDir(aOutputDir)
+  {
+    mIfaceTable.Init(100);
+
+    PRUint32 size = NS_ARRAY_LENGTH(kJavaKeywords);
+    mJavaKeywords.Init(size);
+    for (PRUint32 i = 0; i < size; i++) {
+      mJavaKeywords.Put(nsDependentCString(kJavaKeywords[i]));
+    }
+
+#ifdef WRITE_NOSCRIPT_METHODS
+    size = NS_ARRAY_LENGTH(kNoscriptMethodIfaces);
+    mNoscriptMethodsTable.Init(size);
+    for (PRUint32 i = 0; i < size; i++) {
+      mNoscriptMethodsTable.Put(nsDependentCString(kNoscriptMethodIfaces[i]));
+    }
+#endif
+  }
+
+  ~Generate()
+  {
+  }
+
+  nsresult GenerateInterfaces()
+  {
+    nsresult rv;
+
+    nsCOMPtr iim = XPTI_GetInterfaceInfoManager();
+    NS_ASSERTION(iim, "could not get interface info manager");
+    nsCOMPtr etor;
+    rv = iim->EnumerateInterfaces(getter_AddRefs(etor));
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    // loop over interfaces
+    etor->First();
+    do {
+      // get current interface
+      nsCOMPtr item;
+      rv = etor->CurrentItem(getter_AddRefs(item));
+      NS_ENSURE_SUCCESS(rv, rv);
+
+      nsCOMPtr iface(do_QueryInterface(item));
+      if (!iface)
+        break;
+
+      // we only care about scriptable interfaces, so skip over those
+      // that aren't
+      PRBool scriptable;
+      iface->IsScriptable(&scriptable);
+      if (!scriptable) {
+        // XXX SWT uses non-scriptable interface 'nsIAppShell' (bug 270892), so
+        // include that one.
+        const char* iface_name;
+        iface->GetNameShared(&iface_name);
+        if (strcmp("nsIAppShell", iface_name) != 0)
+          continue;
+      }
+
+      rv = WriteOneInterface(iface);
+      NS_ENSURE_SUCCESS(rv, rv);
+
+    } while (NS_SUCCEEDED(etor->Next()));
+
+    return NS_OK;
+  }
+
+  nsresult WriteOneInterface(nsIInterfaceInfo* aIInfo)
+  {
+    nsresult rv;
+
+    // write each interface only once
+    const char* iface_name;
+    aIInfo->GetNameShared(&iface_name);
+    if (mIfaceTable.Contains(nsDependentCString(iface_name)))
+      return NS_OK;
+
+    // write any parent interface
+    nsCOMPtr parentInfo;
+    PRUint16 parentMethodCount, parentConstCount;
+    rv = TypeInfo::GetParentInfo(aIInfo, getter_AddRefs(parentInfo),
+                                 &parentMethodCount, &parentConstCount);
+    NS_ENSURE_SUCCESS(rv, rv);
+    if (parentInfo)
+      WriteOneInterface(parentInfo);
+
+    mIfaceTable.Put(nsDependentCString(iface_name));
+
+    // create file for interface
+    nsCOMPtr out;
+    rv = OpenIfaceFileStream(iface_name, getter_AddRefs(out));
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    // write contents to file
+    rv = WriteHeader(out);
+    NS_ENSURE_SUCCESS(rv, rv);
+    rv = WriteInterfaceStart(out, aIInfo, parentInfo);
+    NS_ENSURE_SUCCESS(rv, rv);
+    rv = WriteIID(out, aIInfo);
+    NS_ENSURE_SUCCESS(rv, rv);
+    rv = WriteConstants(out, aIInfo, parentConstCount);
+    NS_ENSURE_SUCCESS(rv, rv);
+    rv = WriteMethods(out, aIInfo, parentMethodCount);
+    NS_ENSURE_SUCCESS(rv, rv);
+    rv = WriteInterfaceEnd(out);
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    rv = CloseIfaceFileStream(out);
+
+    return rv;
+  }
+
+  nsresult OpenIfaceFileStream(const char* aIfaceName,
+                               nsIOutputStream** aResult)
+  {
+    nsresult rv;
+
+    // create interface file in output dir
+    nsCOMPtr iface_file;
+    rv = mOutputDir->Clone(getter_AddRefs(iface_file));
+    NS_ENSURE_SUCCESS(rv, rv);
+    nsAutoString filename;
+    filename.AppendASCII(aIfaceName);
+    filename.AppendLiteral(".java");
+    rv = iface_file->Append(filename);
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    // create interface file
+    PRBool exists;
+    iface_file->Exists(&exists);
+    if (exists)
+      iface_file->Remove(PR_FALSE);
+    rv = iface_file->Create(nsIFile::NORMAL_FILE_TYPE, 0644);
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    // create output stream for writing to file
+    nsCOMPtr out;
+    rv = NS_NewLocalFileOutputStream(getter_AddRefs(out), iface_file);
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    *aResult = out;
+    NS_ADDREF(*aResult);
+    return NS_OK;
+  }
+
+  nsresult CloseIfaceFileStream(nsIOutputStream* out)
+  {
+    return out->Close();
+  }
+
+  nsresult WriteHeader(nsIOutputStream* out)
+  {
+    static const char kHeader[] = "/**\n * NOTE: THIS IS A GENERATED FILE. "
+                               "PLEASE CONSULT THE ORIGINAL IDL FILE FOR \n"
+                               " * THE FULL DOCUMENTION AND LICENSE.\n **/\n\n";
+    static const char kPackage[] = "package org.mozilla.xpcom;\n\n";
+
+    PRUint32 count;
+    nsresult rv = out->Write(kHeader, sizeof(kHeader) - 1, &count);
+    NS_ENSURE_SUCCESS(rv, rv);
+    rv = out->Write(kPackage, sizeof(kPackage) - 1, &count);
+    return rv;
+  }
+
+  nsresult WriteInterfaceStart(nsIOutputStream* out, nsIInterfaceInfo* aIInfo,
+                              nsIInterfaceInfo* aParentInfo)
+  {
+    static const char kIfaceDecl1[] = "public interface ";
+    static const char kParentDecl[] = " extends ";
+    static const char kIfaceDecl2[] = "\n{\n";
+
+    const char* iface_name;
+    aIInfo->GetNameShared(&iface_name);
+    PRUint32 count;
+    nsresult rv = out->Write(kIfaceDecl1, sizeof(kIfaceDecl1) - 1, &count);
+    NS_ENSURE_SUCCESS(rv, rv);
+    rv = out->Write(iface_name, strlen(iface_name), &count);
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    if (aParentInfo) {
+      const char* parent_name;
+      aParentInfo->GetNameShared(&parent_name);
+      rv = out->Write(kParentDecl, sizeof(kParentDecl) - 1, &count);
+      NS_ENSURE_SUCCESS(rv, rv);
+      rv = out->Write(parent_name, strlen(parent_name), &count);
+      NS_ENSURE_SUCCESS(rv, rv);
+    }
+
+    rv = out->Write(kIfaceDecl2, sizeof(kIfaceDecl2) - 1, &count);
+    return rv;
+  }
+
+  nsresult WriteInterfaceEnd(nsIOutputStream* out)
+  {
+    PRUint32 count;
+    return out->Write("}\n", 2, &count);
+  }
+
+  nsresult WriteIID(nsIOutputStream* out, nsIInterfaceInfo* aIInfo)
+  {
+    static const char kIIDDecl1[] = "  public static final String ";
+    static const char kIIDDecl2[] = " =\n    \"";
+    static const char kIIDDecl3[] = "\";\n\n";
+
+    nsIID* iid = nsnull;
+    aIInfo->GetInterfaceIID(&iid);
+    if (!iid)
+      return NS_ERROR_OUT_OF_MEMORY;
+
+    // create iid field name
+    nsCAutoString iid_name;
+    const char* iface_name;
+    aIInfo->GetNameShared(&iface_name);
+    if (strncmp("ns", iface_name, 2) == 0) {
+      iid_name.AppendLiteral("NS_");
+      iid_name.Append(iface_name + 2);
+    } else {
+      iid_name.Append(iface_name);
+    }
+    iid_name.AppendLiteral("_IID");
+    ToUpperCase(iid_name);
+
+    // get iid string
+    char* iid_str = iid->ToString();
+    if (!iid_str)
+      return NS_ERROR_OUT_OF_MEMORY;
+
+    PRUint32 count;
+    nsresult rv = out->Write(kIIDDecl1, sizeof(kIIDDecl1) - 1, &count);
+    NS_ENSURE_SUCCESS(rv, rv);
+    rv = out->Write(iid_name.get(), iid_name.Length(), &count);
+    NS_ENSURE_SUCCESS(rv, rv);
+    rv = out->Write(kIIDDecl2, sizeof(kIIDDecl2) - 1, &count);
+    NS_ENSURE_SUCCESS(rv, rv);
+    rv = out->Write(iid_str, strlen(iid_str), &count);
+    NS_ENSURE_SUCCESS(rv, rv);
+    rv = out->Write(kIIDDecl3, sizeof(kIIDDecl3) - 1, &count);
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    // cleanup
+    PR_Free(iid_str);
+    nsMemory::Free(iid);
+    return NS_OK;
+  }
+
+  nsresult WriteConstants(nsIOutputStream* out, nsIInterfaceInfo* aIInfo,
+                          PRUint16 aParentConstCount)
+  {
+    static const char kConstDecl1[] = "  public static final ";
+    static const char kConstDecl2[] = " = ";
+    static const char kConstDecl3[] = ";\n\n";
+
+    PRUint16 constCount;
+    nsresult rv = aIInfo->GetConstantCount(&constCount);
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    for (PRUint16 i = aParentConstCount; i < constCount; i++) {
+      const nsXPTConstant* constInfo;
+      rv = aIInfo->GetConstant(i, &constInfo);
+      NS_ENSURE_SUCCESS(rv, rv);
+
+      PRUint32 count;
+      rv = out->Write(kConstDecl1, sizeof(kConstDecl1) - 1, &count);
+      NS_ENSURE_SUCCESS(rv, rv);
+      const nsXPTType &type = constInfo->GetType();
+      rv = WriteType(out, &type, aIInfo, nsnull, nsnull);
+      NS_ENSURE_SUCCESS(rv, rv);
+      rv = out->Write(" ", 1, &count);
+      NS_ENSURE_SUCCESS(rv, rv);
+      const char* name = constInfo->GetName();
+      rv = out->Write(name, strlen(name), &count);
+      NS_ENSURE_SUCCESS(rv, rv);
+      rv = out->Write(kConstDecl2, sizeof(kConstDecl2) - 1, &count);
+      NS_ENSURE_SUCCESS(rv, rv);
+
+      rv = WriteConstantValue(out, &type, constInfo->GetValue());
+      NS_ENSURE_SUCCESS(rv, rv);
+      rv = out->Write(kConstDecl3, sizeof(kConstDecl3) - 1, &count);
+      NS_ENSURE_SUCCESS(rv, rv);
+    }
+
+    return NS_OK;
+  }
+
+  nsresult WriteConstantValue(nsIOutputStream* out, const nsXPTType* aType,
+                              const nsXPTCMiniVariant* aValue)
+  {
+    char buf[32];
+    switch (aType->TagPart()) {
+      case nsXPTType::T_I8:
+        snprintf(buf, sizeof(buf), "%d", aValue->val.i8);
+        break;
+
+      case nsXPTType::T_U8:
+        snprintf(buf, sizeof(buf), "%u", aValue->val.u8);
+        break;
+
+      case nsXPTType::T_I16:
+        snprintf(buf, sizeof(buf), "%d", aValue->val.i16);
+        break;
+
+      case nsXPTType::T_U16:
+        snprintf(buf, sizeof(buf), "%u", aValue->val.u16);
+        break;
+
+      case nsXPTType::T_I32:
+        snprintf(buf, sizeof(buf), "%d", aValue->val.i32);
+        break;
+
+      case nsXPTType::T_U32:
+        snprintf(buf, sizeof(buf), "%uL", aValue->val.u32);
+        break;
+
+      case nsXPTType::T_I64:
+        snprintf(buf, sizeof(buf), "%lldL", aValue->val.i64);
+        break;
+
+      case nsXPTType::T_U64:
+        snprintf(buf, sizeof(buf), "%lluL", aValue->val.u64);
+        break;
+
+      case nsXPTType::T_FLOAT:
+        snprintf(buf, sizeof(buf), "%f", aValue->val.f);
+        break;
+
+      case nsXPTType::T_DOUBLE:
+        snprintf(buf, sizeof(buf), "%f", aValue->val.d);
+        break;
+
+      case nsXPTType::T_BOOL:
+        if (aValue->val.b)
+          sprintf(buf, "true");
+        else
+          sprintf(buf, "false");
+        break;
+
+      case nsXPTType::T_CHAR:
+        snprintf(buf, sizeof(buf), "%c", aValue->val.c);
+        break;
+
+      case nsXPTType::T_WCHAR:
+        snprintf(buf, sizeof(buf), "%c", aValue->val.wc);
+        break;
+
+      default:
+        NS_WARNING("unexpected constant type");
+        return NS_ERROR_UNEXPECTED;
+    }
+
+    PRUint32 count;
+    return out->Write(buf, strlen(buf), &count);
+  }
+
+  nsresult WriteMethods(nsIOutputStream* out, nsIInterfaceInfo* aIInfo,
+                        PRUint16 aParentMethodCount)
+  {
+    PRUint16 methodCount;
+    nsresult rv = aIInfo->GetMethodCount(&methodCount);
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    for (PRUint16 i = aParentMethodCount; i < methodCount; i++) {
+      const nsXPTMethodInfo* methodInfo;
+      rv = aIInfo->GetMethodInfo(i, &methodInfo);
+      NS_ENSURE_SUCCESS(rv, rv);
+
+#ifdef WRITE_NOSCRIPT_METHODS
+      // XXX
+      // SWT makes use of [noscript] methods in some classes, so output them
+      // for those classes.
+
+      // skip [notxpcom] methods
+      if (methodInfo->IsNotXPCOM())
+        continue;
+
+      // skip most hidden ([noscript]) methods
+      if (methodInfo->IsHidden()) {
+        const char* iface_name;
+        aIInfo->GetNameShared(&iface_name);
+        if (!mNoscriptMethodsTable.Contains(nsDependentCString(iface_name)))
+          continue;
+      }
+#else
+      // skip hidden ([noscript]) or [notxpcom] methods
+      if (methodInfo->IsHidden() || methodInfo->IsNotXPCOM())
+        continue;
+#endif
+
+      rv = WriteOneMethod(out, aIInfo, methodInfo, i);
+      NS_ENSURE_SUCCESS(rv, rv);
+    }
+
+    return NS_OK;
+  }
+
+  nsresult WriteOneMethod(nsIOutputStream* out, nsIInterfaceInfo* aIInfo,
+                          const nsXPTMethodInfo* aMethodInfo,
+                          PRUint16 aMethodIndex)
+  {
+    static const char kMethodDecl1[] = "  public ";
+    static const char kVoidReturn[] = "void";
+    static const char kParamSeparator[] = ", ";
+    static const char kMethodDecl2[] = ");\n\n";
+
+    PRUint32 count;
+    nsresult rv = out->Write(kMethodDecl1, sizeof(kMethodDecl1) - 1, &count);
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    // write return type
+    PRUint8 paramCount = aMethodInfo->GetParamCount();
+    const nsXPTParamInfo* resultInfo = nsnull;
+    for (PRUint8 i = 0; i < paramCount; i++) {
+      const nsXPTParamInfo ¶mInfo = aMethodInfo->GetParam(i);
+      if (paramInfo.IsRetval()) {
+        resultInfo = ¶mInfo;
+        break;
+      }
+    }
+    if (resultInfo) {
+      rv = WriteParam(out, aIInfo, aMethodIndex, resultInfo, 0);
+    } else {
+      rv = out->Write(kVoidReturn, sizeof(kVoidReturn) - 1, &count);
+    }
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    // write method name string
+    nsCAutoString method_name;
+    const char* name = aMethodInfo->GetName();
+    if (aMethodInfo->IsGetter() || aMethodInfo->IsSetter()) {
+      if (aMethodInfo->IsGetter())
+        method_name.AppendLiteral("get");
+      else
+        method_name.AppendLiteral("set");
+      method_name.Append(toupper(name[0]));
+      method_name.AppendASCII(name + 1);
+    } else {
+      method_name.Append(tolower(name[0]));
+      method_name.AppendASCII(name + 1);
+      // don't use Java keywords as method names
+      if (mJavaKeywords.Contains(method_name))
+        method_name.Append('_');
+    }
+    rv = out->Write(" ", 1, &count);
+    NS_ENSURE_SUCCESS(rv, rv);
+    rv = out->Write(method_name.get(), method_name.Length(), &count);
+    NS_ENSURE_SUCCESS(rv, rv);
+    rv = out->Write("(", 1, &count);
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    // write parameters
+    for (PRUint8 i = 0; i < paramCount; i++) {
+      const nsXPTParamInfo ¶mInfo = aMethodInfo->GetParam(i);
+      if (paramInfo.IsRetval())
+        continue;
+
+      if (i != 0) {
+        rv = out->Write(kParamSeparator, sizeof(kParamSeparator) - 1, &count);
+        NS_ENSURE_SUCCESS(rv, rv);
+      }
+
+      rv = WriteParam(out, aIInfo, aMethodIndex, ¶mInfo, i + 1);
+      NS_ENSURE_SUCCESS(rv, rv);
+    }
+
+    rv = out->Write(kMethodDecl2, sizeof(kMethodDecl2) - 1, &count);
+    return rv;
+  }
+
+  nsresult WriteParam(nsIOutputStream* out, nsIInterfaceInfo* aIInfo,
+                      PRUint16 aMethodIndex, const nsXPTParamInfo* aParamInfo,
+                      PRUint8 aIndex)
+  {
+    const nsXPTType &type = aParamInfo->GetType();
+    nsresult rv = WriteType(out, &type, aIInfo, aMethodIndex, aParamInfo);
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    // if parameter is 'out' or 'inout', make it a Java array
+    PRUint32 count;
+    if (aParamInfo->IsOut() && !aParamInfo->IsRetval()) {
+      rv = out->Write("[]", 2, &count);
+      NS_ENSURE_SUCCESS(rv, rv);
+    }
+
+    // write name for parameter (but not for 'retval' param)
+    if (aIndex) {
+      char buf[10];
+      snprintf(buf, sizeof(buf), " arg%d", aIndex);
+      rv = out->Write(buf, strlen(buf), &count);
+      NS_ENSURE_SUCCESS(rv, rv);
+    }
+
+    return NS_OK;
+  }
+
+  /**
+   * Write out the Java type for the given XPIDL type.
+   *
+   * NOTE: Java doesn't support unsigned types.  So for any unsigned XPIDL type,
+   * we move up to the next largest Java type.  This way we ensure that we don't
+   * lose any info.
+   */
+  nsresult WriteType(nsIOutputStream* out, const nsXPTType* aType,
+                     nsIInterfaceInfo* aIInfo, PRUint16 aMethodIndex,
+                     const nsXPTParamInfo* aParamInfo)
+  {
+    nsresult rv;
+    PRUint32 count;
+    switch (aType->TagPart()) {
+      case nsXPTType::T_I8:
+        rv = out->Write("byte", 4, &count);
+        break;
+
+      case nsXPTType::T_I16:
+      case nsXPTType::T_U8:
+        rv = out->Write("short", 5, &count);
+        break;
+
+      case nsXPTType::T_I32:
+      case nsXPTType::T_U16:
+        rv = out->Write("int", 3, &count);
+        break;
+
+      case nsXPTType::T_I64:
+      case nsXPTType::T_U32:
+        rv = out->Write("long", 4, &count);
+        break;
+
+      case nsXPTType::T_FLOAT:
+        rv = out->Write("float", 5, &count);
+        break;
+
+      // XXX how should we handle 64-bit values?
+      case nsXPTType::T_U64:
+      case nsXPTType::T_DOUBLE:
+        rv = out->Write("double", 6, &count);
+        break;
+
+      case nsXPTType::T_BOOL:
+        rv = out->Write("boolean", 7, &count);
+        break;
+
+      case nsXPTType::T_CHAR:
+      case nsXPTType::T_WCHAR:
+        rv = out->Write("char", 4, &count);
+        break;
+
+      case nsXPTType::T_CHAR_STR:
+      case nsXPTType::T_WCHAR_STR:
+      case nsXPTType::T_IID:
+      case nsXPTType::T_ASTRING:
+      case nsXPTType::T_DOMSTRING:
+      case nsXPTType::T_UTF8STRING:
+      case nsXPTType::T_CSTRING:
+      case nsXPTType::T_PSTRING_SIZE_IS:
+      case nsXPTType::T_PWSTRING_SIZE_IS:
+        rv = out->Write("String", 6, &count);
+        break;
+
+      case nsXPTType::T_INTERFACE:
+      {
+        char* iface_name = nsnull;
+        rv = TypeInfo::GetInterfaceName(aIInfo, aMethodIndex, aParamInfo,
+                                        &iface_name);
+        if (NS_FAILED(rv) || !iface_name) {
+          rv = NS_ERROR_FAILURE;
+          break;
+        }
+
+        rv = out->Write(iface_name, strlen(iface_name), &count);
+        nsMemory::Free(iface_name);
+        break;
+      }
+
+      case nsXPTType::T_INTERFACE_IS:
+        rv = out->Write("nsISupports", 11, &count);
+        break;
+
+      case nsXPTType::T_VOID:
+        rv = out->Write("int", 3, &count);
+        break;
+
+      case nsXPTType::T_ARRAY:
+      {
+        // get array type
+        nsXPTType xpttype;
+        rv = aIInfo->GetTypeForParam(aMethodIndex, aParamInfo, 1, &xpttype);
+        if (NS_FAILED(rv))
+          break;
+
+        rv = WriteType(out, &xpttype, aIInfo, aMethodIndex, aParamInfo);
+        if (NS_FAILED(rv))
+          break;
+
+        rv = out->Write("[]", 2, &count);
+        break;
+      }
+
+      default:
+        fprintf(stderr, "WARNING: unexpected parameter type %d\n",
+                aType->TagPart());
+        return NS_ERROR_UNEXPECTED;
+    }
+
+    return rv;
+  }
+};
+
+void PrintUsage(char** argv)
+{
+  static const char usage_str[] =
+      "Usage: %s -d path\n"
+      "         -d output directory for Java interface files\n";
+  fprintf(stderr, usage_str, argv[0]);
+}
+
+int main(int argc, char** argv)
+{
+  nsresult rv = NS_OK;
+  nsCOMPtr output_dir;
+
+  // handle command line arguments
+  for (int i = 1; i < argc; i++) {
+    if (argv[i][0] != '-') {
+      rv = NS_ERROR_FAILURE;
+      break;
+    }
+
+    switch (argv[i][1]) {
+      case 'd': {
+        if (i + 1 == argc) {
+          fprintf(stderr, "ERROR: missing output directory after -d\n");
+          rv = NS_ERROR_FAILURE;
+          break;
+        }
+
+        // see if given path exists
+        output_dir = new nsLocalFile();
+        rv = output_dir->InitWithNativePath(nsDependentCString(argv[++i]));
+        PRBool val;
+        if (NS_FAILED(rv) || NS_FAILED(output_dir->Exists(&val)) || !val ||
+            NS_FAILED(output_dir->IsDirectory(&val)) || !val)
+        {
+          fprintf(stderr,
+                  "ERROR: output directory doesn't exist / isn't a directory\n");
+          rv = NS_ERROR_FAILURE;
+          break;
+        }
+
+        break;
+      }
+
+      default: {
+        fprintf(stderr, "ERROR: unknown option %s\n", argv[i]);
+        rv = NS_ERROR_FAILURE;
+        break;
+      }
+    }
+  }
+
+  if (NS_FAILED(rv)) {
+    PrintUsage(argv);
+    return 1;
+  }
+
+  rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  Generate gen(output_dir);
+  rv = gen.GenerateInterfaces();
+
+  NS_ShutdownXPCOM(nsnull);
+  return rv;
+}
diff --git a/extensions/java/xpcom/tools/genifaces/Makefile.in b/extensions/java/xpcom/tools/genifaces/Makefile.in
new file mode 100644
index 00000000000..14ea124eb94
--- /dev/null
+++ b/extensions/java/xpcom/tools/genifaces/Makefile.in
@@ -0,0 +1,64 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is Java XPCOM Bindings.
+#
+# The Initial Developer of the Original Code is
+# IBM Corporation.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# IBM Corporation. All Rights Reserved.
+#
+# Contributor(s):
+#   Javier Pedemonte (jhpedemonte@gmail.com)
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH		= ../../../../..
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE = javaxpcom
+MOZILLA_INTERNAL_API=1
+
+REQUIRES = \
+			xpcom \
+			string \
+			necko \
+			$(NULL)
+
+CPPSRCS = GenerateJavaInterfaces.cpp
+
+SIMPLE_PROGRAMS	= GenerateJavaInterfaces$(BIN_SUFFIX)
+
+LIBS		+= \
+		$(LIBS_DIR) \
+		$(MOZ_COMPONENT_LIBS) \
+		$(NULL)
+
+include $(topsrcdir)/config/rules.mk
+
diff --git a/netwerk/mime/public/Makefile.in b/netwerk/mime/public/Makefile.in
index faa67602101..f8711bb922e 100644
--- a/netwerk/mime/public/Makefile.in
+++ b/netwerk/mime/public/Makefile.in
@@ -45,10 +45,6 @@ include $(DEPTH)/config/autoconf.mk
 MODULE		= mimetype
 XPIDL_MODULE	= mimetype
 
-JAVA_XPIDLSRCS = \
-		nsIMIMEInfo.idl \
-		$(NULL)
-
 XPIDLSRCS	= \
 		nsIMIMEService.idl \
 		nsIMIMEInfo.idl \
diff --git a/uriloader/base/Makefile.in b/uriloader/base/Makefile.in
index 213d125745b..34187cfc174 100644
--- a/uriloader/base/Makefile.in
+++ b/uriloader/base/Makefile.in
@@ -76,12 +76,6 @@ SDK_XPIDLSRCS = 						\
 				nsIWebProgressListener.idl 	\
 				$(NULL)
 
-JAVA_XPIDLSRCS = \
-				nsIDownload.idl \
-				nsITransfer.idl \
-				nsIWebProgressListener2.idl \
-				$(NULL)
-
 XPIDLSRCS = 							\
 				nsIContentHandler.idl 		\
 				nsIURILoader.idl	 	\
diff --git a/uriloader/exthandler/Makefile.in b/uriloader/exthandler/Makefile.in
index 33340082c74..a89ebe3e0b9 100644
--- a/uriloader/exthandler/Makefile.in
+++ b/uriloader/exthandler/Makefile.in
@@ -122,11 +122,6 @@ EXPORTS = \
 		$(OSDIR)/nsOSHelperAppService.h \
 			$(NULL)
 
-JAVA_XPIDLSRCS = \
-		nsIExternalHelperAppService.idl \
-		nsIHelperAppLauncherDialog.idl \
-		$(NULL)
-
 XPIDLSRCS = \
 	nsCExternalHandlerService.idl	\
 	nsIExternalProtocolService.idl \
diff --git a/widget/public/Makefile.in b/widget/public/Makefile.in
index 243cf1e9d8d..fe24f35fa0b 100644
--- a/widget/public/Makefile.in
+++ b/widget/public/Makefile.in
@@ -77,11 +77,6 @@ ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
 EXPORTS       += nsWidgetAtoms.h nsWidgetAtomList.h
 endif
 
-JAVA_XPIDLSRCS = \
-		nsIAppShell.idl \
-		nsIBaseWindow.idl \
-		$(NULL)
-
 XPIDLSRCS	= \
 		nsIAppShell.idl \
 		nsIFilePicker.idl \
diff --git a/xpcom/ds/Makefile.in b/xpcom/ds/Makefile.in
index 15cf28106e5..c31611954bf 100644
--- a/xpcom/ds/Makefile.in
+++ b/xpcom/ds/Makefile.in
@@ -164,10 +164,6 @@ SDK_XPIDLSRCS   = \
 		nsISupportsPrimitives.idl  \
 		$(NULL)
 
-JAVA_XPIDLSRCS   = \
-		nsIArray.idl  \
-		$(NULL)
-
 EXPORTS		:= $(addprefix $(srcdir)/, $(EXPORTS))
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
diff --git a/xpcom/typelib/Makefile.in b/xpcom/typelib/Makefile.in
index b108f14c0bd..5da767ffade 100644
--- a/xpcom/typelib/Makefile.in
+++ b/xpcom/typelib/Makefile.in
@@ -49,9 +49,5 @@ ifndef WINCE
 DIRS        += xpidl
 endif
 
-ifdef MOZ_ENABLE_JAVAXPCOM
-DIRS += $(DEPTH)/extensions/java/xpcom/tools/xpidl
-endif
-
 include $(topsrcdir)/config/rules.mk