diff --git a/java/xpcom/java/Makefile.in b/java/xpcom/java/Makefile.in index ab4e21d0e62..4b3add6913f 100644 --- a/java/xpcom/java/Makefile.in +++ b/java/xpcom/java/Makefile.in @@ -27,6 +27,6 @@ srcdir = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS= xpidl src loader classes components +DIRS= xpidl src loader import classes components test include $(topsrcdir)/config/rules.mk diff --git a/java/xpcom/java/classes/org/mozilla/xpcom/nsIComponentManager.java b/java/xpcom/java/classes/org/mozilla/xpcom/CID.java similarity index 100% rename from java/xpcom/java/classes/org/mozilla/xpcom/nsIComponentManager.java rename to java/xpcom/java/classes/org/mozilla/xpcom/CID.java diff --git a/java/xpcom/java/classes/org/mozilla/xpcom/nsIEnumerator.java b/java/xpcom/java/classes/org/mozilla/xpcom/ID.java similarity index 100% rename from java/xpcom/java/classes/org/mozilla/xpcom/nsIEnumerator.java rename to java/xpcom/java/classes/org/mozilla/xpcom/ID.java diff --git a/java/xpcom/java/classes/org/mozilla/xpcom/IID.java b/java/xpcom/java/classes/org/mozilla/xpcom/IID.java index 9fc0cd169bf..e69de29bb2d 100644 --- a/java/xpcom/java/classes/org/mozilla/xpcom/IID.java +++ b/java/xpcom/java/classes/org/mozilla/xpcom/IID.java @@ -1,58 +0,0 @@ -/* -*- Mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * 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 mozilla.org code. - * - * The Initial Developer of the Original Code is Sun Microsystems, - * Inc. Portions created by Sun are - * Copyright (C) 1999 Sun Microsystems, Inc. All - * Rights Reserved. - * - * Contributor(s): - * Igor Kushnirskiy - */ -package org.mozilla.xpcom; - -public class IID { - public IID(String iid) { - this.iid = ((iid == null) ? "" : iid).toLowerCase();; - } - public boolean equals(Object obj) { - if (! (obj instanceof IID)) { - return false; - } - boolean res = iid.equals(((IID)obj).iid); - return res; - } - public String toString() { - return "org.mozilla.xpcom.IID@"+iid; - } - public int hashCode() { - int h = iid.hashCode(); - return h; - } - public String getString() { - return iid; - } - private String iid; - public static Class TYPE; - static { - try { - TYPE = Class.forName("org.mozilla.xpcom.Proxy"); - } catch (Exception e) { //it could not happen - TYPE = null; - } - } - -} - - - diff --git a/java/xpcom/java/classes/org/mozilla/xpcom/InterfaceRegistry.java b/java/xpcom/java/classes/org/mozilla/xpcom/InterfaceRegistry.java index ff91e777f96..e69de29bb2d 100644 --- a/java/xpcom/java/classes/org/mozilla/xpcom/InterfaceRegistry.java +++ b/java/xpcom/java/classes/org/mozilla/xpcom/InterfaceRegistry.java @@ -1,244 +0,0 @@ -/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * 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 mozilla.org code. - * - * The Initial Developer of the Original Code is Sun Microsystems, - * Inc. Portions created by Sun are - * Copyright (C) 1999 Sun Microsystems, Inc. All - * Rights Reserved. - * - * Contributor(s): - * Denis Sharypov - */ - -package org.mozilla.xpcom; - -import java.util.HashSet; -import java.util.Hashtable; -import java.lang.reflect.*; - -public class InterfaceRegistry { - - private static String IID_STRING = "IID"; - private static Hashtable interfaces = null; - private static Hashtable iMethods = null; - private static HashSet keywords = null; - private static boolean debug = true; - - private InterfaceRegistry() { - } - - public static void register(nsISupports obj) { - if (obj == null) { - return; - } - Class cl = obj.getClass(); - register(cl); - } - - public static void register(String name) { - try { - register(Class.forName(name)); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void register(Class cl) { - if (cl == null) { - return; - } - if (interfaces == null) { - interfaces = new Hashtable(); - } - if (iMethods == null) { - iMethods = new Hashtable(); - } - if (keywords == null) { - keywords = new HashSet(javaKeywords.length); - for (int i = 0; i < javaKeywords.length; i++) { - keywords.add(javaKeywords[i]); - } - } - if (!cl.isInterface()) { - Class[] ifaces = cl.getInterfaces(); - for (int i = 0; i < ifaces.length; i++) { - registerInterfaces(ifaces[i]); - } - } else { - registerInterfaces(cl); - } - } - - public static void unregister(IID iid) { - interfaces.remove(iid); - iMethods.remove(iid); - } - - private static Hashtable registerInterfaces(Class cl) { - try { - Object iidStr = cl.getField(IID_STRING).get(cl); - if (iidStr instanceof String) { - IID iid = new IID((String)iidStr); - // if this iface hasn't been registered, yet - if (interfaces.get(iid) == null) { - String[] methodNames = Utilities.getInterfaceMethodNames((String)iidStr); - if (methodNames != null) { - Method[] rmethods = new Method[methodNames.length]; - Class[] ifaces = cl.getInterfaces(); - // check for single inheritance (xpcom) - if (ifaces.length < 2) { - // recursively get all parent interface methods - Hashtable mhash = null; - Method[] methods = cl.getDeclaredMethods(); - // the very super iface - if (ifaces.length == 0) { - mhash = new Hashtable(methods.length); - } else { - mhash = new Hashtable(registerInterfaces(ifaces[0])); - } - for (int i = 0; i < methods.length; i++) { - mhash.put(methods[i].getName(), methods[i]); - } - - for (int j = methodNames.length - 1; j >= 0; j--) { - rmethods[j] = (Method)mhash.get(subscriptMethodName(methodNames[j])); - } - - interfaces.put(iid, cl); - iMethods.put(iid, new MethodArray(rmethods, mhash)); - - debug(cl.getName() + ": " + iid + " ( " + cl + " )"); - printMethods(rmethods); - - return mhash; - } - } - // simply pass iface methods - } else { - MethodArray m = (MethodArray)iMethods.get(iid); - if (m != null) { - return m.names; - } - } - } - } catch (NoSuchFieldException e) { - // the interface doesn't define IID field - debug("no such field..."); - } catch (IllegalAccessException e1) { - debug("can't access field..."); - } - return new Hashtable(); - } - - public static Class getInterface(IID iid) { - Object obj = null; - if (interfaces != null) { - obj = interfaces.get(iid); - } - if (obj == null || !(obj instanceof Class)) { - return null; - } - return (Class)obj; - } - - public static Method getMethodByIndex(int index, IID iid) { - Method result = null; - MethodArray m = (MethodArray)iMethods.get(iid); - if (m != null && m.methods !=null) { - try { - result = m.methods[index]; - } catch (Exception e) { - e.printStackTrace(); - } - } - return result; - } - - public static int getIndexByMethod(Method method, IID iid) { - int result = -1; - MethodArray m = (MethodArray)iMethods.get(iid); - if (m != null && m.methods != null) { - for (int i = 0; i < m.methods.length; i++) { - if (m.methods[i] != null && method.equals(m.methods[i])) { - result = i; - break; - } - } - } - return result; - } - - private static String subscriptMethodName(String str) { - if (keywords.contains(str)) { - return str + "_"; - } - return str; - } - - // methods for debugging - - private static void printMethods(Method[] methods) { - if (debug) { - for (int i = 0; i < methods.length; i++) { - printMethod(methods[i]); - } - } - } - - private static void printMethod(Method m) { - if (m == null) { - Debug.log(""); - return; - } - Class retType = m.getReturnType(); - Class[] paramTypes = m.getParameterTypes(); - String name = m.getName(); - System.out.print(Modifier.toString(m.getModifiers())); - System.out.print(" " + retType.getName() + " " + name - + "("); - for (int j = 0; j < paramTypes.length; j++) { - if (j > 0) System.out.print(", "); - System.out.print(paramTypes[j].getName()); - } - Debug.log(");"); - } - - private static void debug(String str) { - if (debug) { - Debug.log(str); - } - } - - private static String[] javaKeywords = { - "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", - // non-final method names of Object class - "toString", "clone" , "finalize" , "hashCode" , "equals"}; -} - -class MethodArray { - Method[] methods; - Hashtable names; - MethodArray(Method[] _methods, Hashtable _names) { - methods = _methods; - names = _names; - } -} diff --git a/java/xpcom/java/classes/org/mozilla/xpcom/nsIFactory.java b/java/xpcom/java/classes/org/mozilla/xpcom/nsIFactory.java deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/java/xpcom/java/classes/org/mozilla/xpcom/nsIFile.java b/java/xpcom/java/classes/org/mozilla/xpcom/nsIFile.java deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/java/xpcom/java/classes/org/mozilla/xpcom/nsISimpleEnumerator.java b/java/xpcom/java/classes/org/mozilla/xpcom/nsISimpleEnumerator.java deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/java/xpcom/java/classes/org/mozilla/xpcom/nsISupports.java b/java/xpcom/java/classes/org/mozilla/xpcom/nsISupports.java deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/java/xpcom/java/classes/org/mozilla/xpcom/nsISupportsString.java b/java/xpcom/java/classes/org/mozilla/xpcom/nsISupportsString.java deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/java/xpcom/java/components/Makefile.in b/java/xpcom/java/components/Makefile.in index 143bb5a7a5f..b54023d6b99 100644 --- a/java/xpcom/java/components/Makefile.in +++ b/java/xpcom/java/components/Makefile.in @@ -37,6 +37,7 @@ XPIDLSRCS = bcIBlackConnectInit.idl CPPSRCS = bcBlackConnectInit.cpp include $(topsrcdir)/config/rules.mk +include ../config/rules.mk COMPONENT=bcBlackConnectInit CLASSES=bcIBlackConnectInit.class bcBlackConnectInit.class @@ -44,7 +45,10 @@ CLASSES=bcIBlackConnectInit.class bcBlackConnectInit.class $(COMPONENT).jar.comp: manifest $(CLASSES) $(JDKHOME)/bin/jar cvfm $(COMPONENT).jar.comp manifest *.class .java.class: - $(JDKHOME)/bin/javac -classpath .:../classes $< + $(JDKHOME)/bin/javac -classpath .:../classes:$(DIST)/classes $< + +bcIBlackConnectInit.java : bcIBlackConnectInit.idl + install-component: $(COMPONENT).jar.comp $(COMPONENT).jar.info cp $(COMPONENT).jar.comp $(COMPONENT).jar.info $(DEPTH)/dist/bin/components/ clobber-java: diff --git a/java/xpcom/java/components/bcBlackConnectInit.java b/java/xpcom/java/components/bcBlackConnectInit.java index 2c019774fb3..849baef2de6 100644 --- a/java/xpcom/java/components/bcBlackConnectInit.java +++ b/java/xpcom/java/components/bcBlackConnectInit.java @@ -26,8 +26,8 @@ public class bcBlackConnectInit implements bcIBlackConnectInit { } public Object queryInterface(IID iid) { Object result; - if ( nsISupportsIID.equals(iid) - || bcIBlackConnectInitIID.equals(iid)) { + if ( nsISupports.IID.equals(iid) + || bcIBlackConnectInit.IID.equals(iid)) { result = this; } else { result = null; @@ -39,9 +39,6 @@ public class bcBlackConnectInit implements bcIBlackConnectInit { Components.setComponentManager(cm); Debug.log("Components.setComponentManager(cm);"); } - - static IID bcIBlackConnectInitIID = new IID(bcIBlackConnectInit.IID); - static IID nsISupportsIID = new IID(nsISupports.IID); static { InterfaceRegistry.register(nsIComponentManager.class); } diff --git a/java/xpcom/java/components/bcIBlackConnectInit.idl b/java/xpcom/java/components/bcIBlackConnectInit.idl index 7d0e7b99164..761416a5631 100644 --- a/java/xpcom/java/components/bcIBlackConnectInit.idl +++ b/java/xpcom/java/components/bcIBlackConnectInit.idl @@ -1,6 +1,7 @@ #include "nsISupports.idl" #include "nsIComponentManager.idl" +#pragma prefix [scriptable, uuid(d4867a7e-1dd1-11b2-a009-b111ab5d7639)] interface bcIBlackConnectInit : nsISupports diff --git a/java/xpcom/java/components/bcIBlackConnectInit.java b/java/xpcom/java/components/bcIBlackConnectInit.java deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/java/xpcom/java/components/makefile.win b/java/xpcom/java/components/makefile.win index ba383b7dbfe..e69de29bb2d 100644 --- a/java/xpcom/java/components/makefile.win +++ b/java/xpcom/java/components/makefile.win @@ -1,66 +0,0 @@ -#!gmake -# -# The contents of this file are subject to the Netscape 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/NPL/ -# -# 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 mozilla.org code. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1999 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): -# Igor Kushnirskiy -# - - -DEPTH = ..\..\..\.. -topsrcdir = ..\..\..\.. -srcdir = . -VPATH = . - -MAKE_OBJ_TYPE=DLL -MODULE=bcBlackConnectInit -COMPONENT=1 -DLLNAME=$(MODULE) -DLL=.\$(OBJDIR)\$(DLLNAME).dll - -XPIDLSRCS = \ - .\bcIBlackConnectInit.idl \ - $(NULL) - -OBJS = .\$(OBJDIR)\bcBlackConnectInit.obj -LLIBS=$(LLIBS) $(LIBNSPR) $(DIST)\lib\xpcom.lib - -include <$(DEPTH)\config\rules.mak> - -COMPONENT=bcBlackConnectInit -CLASSES=bcIBlackConnectInit.class bcBlackConnectInit.class - -$(COMPONENT).jar.comp: manifest $(CLASSES) - $(JDKHOME)\bin\jar cvfm $(COMPONENT).jar.comp manifest *.class - -.SUFFIXES: .java .class - -.java.class: - $(JDKHOME)\bin\javac -classpath .;..\classes $< - -install-component: $(COMPONENT).jar.comp $(COMPONENT).jar.info $(DLL) - copy $(COMPONENT).jar* $(DIST)\bin\components - copy $(DLL) $(DIST)\bin\components - -clobber-java: - -del *.class *.jar.comp -clobber:: clobber-java - rm -f "$(DIST)\bin\components\$(DLLNAME).dll" - rm -f "$(DIST)\bin\components\$(COMPONENT).jar.*" -clobber_all:: clobber-java -install:: install-component diff --git a/java/xpcom/java/loader/bcJavaComponentLoader.cpp b/java/xpcom/java/loader/bcJavaComponentLoader.cpp index c7bdf46a928..748ed30b0cf 100644 --- a/java/xpcom/java/loader/bcJavaComponentLoader.cpp +++ b/java/xpcom/java/loader/bcJavaComponentLoader.cpp @@ -454,14 +454,12 @@ UnregisterJavaLoader(nsIComponentManager *aCompMgr, nsIFile *aPath, NS_GENERIC_FACTORY_CONSTRUCTOR(bcJavaComponentLoader); -static nsModuleComponentInfo components[] = { +static nsModuleComponentInfo components_loader[] = { { "Java component loader", BC_JAVACOMPONENTLOADER_CID, BC_JAVACOMPONENTLOADER_ContractID, bcJavaComponentLoaderConstructor, RegisterJavaLoader, UnregisterJavaLoader }, }; -NS_IMPL_NSGETMODULE("Java component loader", components); - - +NS_IMPL_NSGETMODULE("Java component loader", components_loader); diff --git a/java/xpcom/java/makefile.win b/java/xpcom/java/makefile.win index 2074cf53f88..a4a26efdcff 100644 --- a/java/xpcom/java/makefile.win +++ b/java/xpcom/java/makefile.win @@ -27,6 +27,7 @@ DIRS= \ xpidl \ loader \ src \ + import \ classes \ # test \ components \ diff --git a/java/xpcom/java/src/bcJavaStubsAndProxies.cpp b/java/xpcom/java/src/bcJavaStubsAndProxies.cpp index 7663f397907..73792971f45 100644 --- a/java/xpcom/java/src/bcJavaStubsAndProxies.cpp +++ b/java/xpcom/java/src/bcJavaStubsAndProxies.cpp @@ -47,13 +47,33 @@ static nsModuleComponentInfo components[] = { { "Black Connect Java stubs and proxies", - BC_JAVASTUBSANDPROXIES_CID, - BC_JAVASTUBSANDPROXIES_PROGID, + BC_JAVASTUBSANDPROXIES_CID, + BC_JAVASTUBSANDPROXIES_ContractID, bcJavaStubsAndProxiesConstructor } }; -NS_IMPL_NSGETMODULE("BlackConnect Java stubs and proxies",components); +//NS_IMPL_NSGETMODULE("BlackConnect Java stubs and proxies",components_stubs); + + +PRUint32 NSGetModule_components_count = + sizeof(components) / sizeof(components[0]); + +nsModuleComponentInfo* NSGetModule_components_idk = (components); + +extern "C" NS_EXPORT nsresult NSGetModule(nsIComponentManager *servMgr, + nsIFile* location, + nsIModule** result) +{ + return NS_NewGenericModule("BlackConnect Java stubs and proxies", + NSGetModule_components_count, + NSGetModule_components_idk, + nsnull, result); +} + + + + NS_IMPL_ISUPPORTS(bcJavaStubsAndProxies,NS_GET_IID(bcJavaStubsAndProxies)); @@ -81,10 +101,14 @@ public: bcJavaStubsAndProxies::bcJavaStubsAndProxies() { NS_INIT_REFCNT(); + PR_LOG(bcJavaGlobal::GetLog(),PR_LOG_DEBUG, + ("--[c++] bcJavaStubsAndProxies::bcJavaStubsAndProxies\n")); oid2objectMap = new nsHashtable(256,PR_TRUE); } bcJavaStubsAndProxies::~bcJavaStubsAndProxies() { + PR_LOG(bcJavaGlobal::GetLog(),PR_LOG_DEBUG, + ("--[c++] bcJavaStubsAndProxies::~bcJavaStubsAndProxies\n")); delete oid2objectMap; } diff --git a/java/xpcom/java/src/bcJavaStubsAndProxies.h b/java/xpcom/java/src/bcJavaStubsAndProxies.h index 696c8622d5d..dc11ae91c27 100644 --- a/java/xpcom/java/src/bcJavaStubsAndProxies.h +++ b/java/xpcom/java/src/bcJavaStubsAndProxies.h @@ -33,7 +33,7 @@ {0x58034ea6, 0x1dd2, 0x11b2, \ {0x9b, 0x58, 0x86, 0x30, 0xab, 0xb8, 0xaf,0x47}} -#define BC_JAVASTUBSANDPROXIES_PROGID "component://netscape/blackwood/blackconnect/java-stubs-and-proxies" +#define BC_JAVASTUBSANDPROXIES_ContractID "@mozilla.org/blackwood/blackconnect/java-stubs-and-proxies" /* 7cadf6e8-1dd2-11b2-9a6e-b1c37844e004 */ #define BC_JAVASTUBSANDPROXIES_CID \ diff --git a/java/xpcom/java/test/Makefile.in b/java/xpcom/java/test/Makefile.in index c9acdc35043..ecab06094b7 100644 --- a/java/xpcom/java/test/Makefile.in +++ b/java/xpcom/java/test/Makefile.in @@ -36,11 +36,15 @@ XPIDL_MODULE = javaSample XPIDLSRCS = bcIJavaSample.idl CPPSRCS = bcJavaSample.cpp include $(topsrcdir)/config/rules.mk +include ../config/rules.mk bcJavaSample.jar.comp: manifest bcIJavaSample.class bcJavaSample.class $(JDKHOME)/bin/jar cvfm bcJavaSample.jar.comp manifest *.class .java.class: - $(JDKHOME)/bin/javac -classpath .:../classes $< + $(JDKHOME)/bin/javac -classpath .:../classes:$(DIST)/classes $< + +bcIJavaSample.java : bcIJavaSample.idl + install-component: bcJavaSample.jar.comp bcJavaSample.jar.info cp bcJavaSample.jar.comp bcJavaSample.jar.info $(DEPTH)/dist/bin/components/ diff --git a/java/xpcom/java/test/bcIJavaSample.idl b/java/xpcom/java/test/bcIJavaSample.idl index c85c44d8248..f181799a926 100644 --- a/java/xpcom/java/test/bcIJavaSample.idl +++ b/java/xpcom/java/test/bcIJavaSample.idl @@ -1,6 +1,7 @@ #include "nsISupports.idl" #include "nsIComponentManager.idl" +#pragma prefix [scriptable, uuid(ca1e2656-1dd1-11b2-9c4e-f49ea557abde)] interface bcIJavaSample : nsISupports { diff --git a/java/xpcom/java/test/bcIJavaSample.java b/java/xpcom/java/test/bcIJavaSample.java deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/java/xpcom/java/test/bcJavaSample.java b/java/xpcom/java/test/bcJavaSample.java index 93e82dbeb6e..5d0ca68f094 100644 --- a/java/xpcom/java/test/bcJavaSample.java +++ b/java/xpcom/java/test/bcJavaSample.java @@ -29,8 +29,8 @@ public class bcJavaSample implements bcIJavaSample { public Object queryInterface(IID iid) { System.out.println("--[java]bcJavaSample::queryInterface iid="+iid); Object result; - if ( iid.equals(nsISupportsIID) - || iid.equals(bcIJavaSampleIID)) { + if ( iid.equals(nsISupports.IID) + || iid.equals(bcIJavaSample.IID)) { result = this; } else { result = null; @@ -99,7 +99,7 @@ public class bcJavaSample implements bcIJavaSample { || counter > 300) { break; } - strObj = (nsISupportsString) obj.queryInterface(nsISupportsStringIID); + strObj = (nsISupportsString) obj.queryInterface(nsISupportsString.IID); str = strObj.getData(); System.out.println("--[java] bcJavaSample.Test5 string "+str); enumerator.next(); counter++; @@ -124,11 +124,6 @@ public class bcJavaSample implements bcIJavaSample { count[0] = retValue.length; valueArray[0] = retValue; } - - static IID bcIJavaSampleIID = new IID(bcIJavaSample.IID); - static IID nsISupportsIID = new IID(nsISupports.IID); - static IID nsIComponenstManagerIID = new IID(nsIComponentManager.IID); - static IID nsISupportsStringIID = new IID(nsISupportsString.IID); static { try { Class nsIComponentManagerClass = diff --git a/java/xpcom/java/test/makefile.win b/java/xpcom/java/test/makefile.win index 650d93edd28..cad039b276c 100644 --- a/java/xpcom/java/test/makefile.win +++ b/java/xpcom/java/test/makefile.win @@ -41,14 +41,16 @@ OBJS = .\$(OBJDIR)\bcJavaSample.obj LLIBS=$(LLIBS) $(LIBNSPR) $(DIST)\lib\xpcom.lib include <$(DEPTH)\config\rules.mak> +include ..\config\rules.mak bcJavaSample.jar.comp: manifest bcIJavaSample.class bcJavaSample.class $(JDKHOME)\bin\jar cvfm bcJavaSample.jar.comp manifest *.class -.SUFFIXES: .java .class .java.class: - $(JDKHOME)\bin\javac -classpath .;..\classes $< + $(JDKHOME)\bin\javac -classpath .;..\classes;$(DEPTH)\dist\classes $< + +bcIJavaSample.java : bcIJavaSample.idl install-component: bcJavaSample.jar.comp bcJavaSample.jar.info $(DLL) copy bcJavaSample.jar* $(DIST)\bin\components @@ -60,4 +62,4 @@ clobber:: clobber-java rm -f "$(DIST)\bin\components\$(DLLNAME).dll" rm -f "$(DIST)\bin\components\bcJavaSample.jar.*" clobber_all:: clobber-java -install:: install-component \ No newline at end of file +install:: install-component diff --git a/java/xpcom/java/xpidl/xpidl_java.c b/java/xpcom/java/xpidl/xpidl_java.c index ad74d762e34..d02c0aec953 100644 --- a/java/xpcom/java/xpidl/xpidl_java.c +++ b/java/xpcom/java/xpidl/xpidl_java.c @@ -20,6 +20,8 @@ * Contributor(s): * Michael Allen (michael.allen@sun.com) * Frank Mitchell (frank.mitchell@sun.com) + * Denis Sharypov (sdv@sparc.spb.su) + * Igor Kushnirskiy (idk@eng.sun.com) */ /* @@ -255,7 +257,7 @@ interface_declaration(TreeState *state) /* } */ /* fprintf(FILENAME(state), " =\n new nsID(\"%s\");\n\n", iid); */ - fprintf(FILENAME(state), " public static final String IID =\n \"%s\";\n\n", iid); + fprintf(FILENAME(state), " public static final IID IID =\n new IID(\"%s\");\n\n", iid); } /* @@ -370,19 +372,22 @@ xpcom_to_java_type (TreeState *state) IDL_NODE_TYPE(IDL_NODE_UP(state->tree)) == IDLN_NATIVE) { const char *user_type = IDL_NATIVE(IDL_NODE_UP(state->tree)).user_type; const char *ident_str = IDL_IDENT(IDL_NATIVE(IDL_NODE_UP(state->tree)).ident).str; - if (strcmp(user_type, "void") == 0) { + if (strcmp(user_type, "void") == 0) { /*it should not happend for scriptable methods*/ fputs("Object", FILENAME(state)); } - else if (strcmp(user_type, "nsID") == 0 || - strcmp(user_type, "nsIID") == 0 || - strcmp(user_type, "nsCID") == 0) { - /* XXX: s.b test for "iid" attribute */ - /* XXX: special class for nsIDs */ + /* XXX: s.b test for "id" attribute */ + /* XXX: special class for nsIDs */ + else if (strcmp(user_type, "nsID") == 0) { + fputs("ID", FILENAME(state)); + } else if (strcmp(user_type, "nsIID") == 0) { fputs("IID", FILENAME(state)); + } else if (strcmp(user_type, "nsCID") == 0) { + fputs("CID", FILENAME(state)); } else { /* XXX: special class for opaque types */ - fputs("OpaqueValue", FILENAME(state)); + /*it should not happend for scriptable methods*/ + fputs("OpaqueValue", FILENAME(state)); } } else { const char *ident_str = IDL_IDENT(state->tree).str;