From 8ed005894dab421b882221d888d5721647399f13 Mon Sep 17 00:00:00 2001 From: Mark Spruiell Date: Wed, 8 Sep 2004 17:30:11 +0000 Subject: bug fixes for metadata validation and ice_staticId() called on interfaces --- cpp/src/Slice/JavaUtil.cpp | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'cpp/src/Slice/JavaUtil.cpp') diff --git a/cpp/src/Slice/JavaUtil.cpp b/cpp/src/Slice/JavaUtil.cpp index 26f12c5ffa3..a4a8ce6ba92 100644 --- a/cpp/src/Slice/JavaUtil.cpp +++ b/cpp/src/Slice/JavaUtil.cpp @@ -1092,7 +1092,8 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out, { bool isObject = false; BuiltinPtr builtin = BuiltinPtr::dynamicCast(origContent); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(origContent)) + ClassDeclPtr cl = ClassDeclPtr::dynamicCast(origContent); + if((builtin && builtin->kind() == Builtin::KindObject) || cl) { isObject = true; } @@ -1107,7 +1108,16 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out, } else { - out << nl << "final String __type" << iter << " = " << origContentS << ".ice_staticId();"; + assert(cl); + if(cl->isInterface()) + { + out << nl << "final String __type" << iter << " = " + << getAbsolute(cl, package, "_", "Disp") << ".ice_staticId();"; + } + else + { + out << nl << "final String __type" << iter << " = " << origContentS << ".ice_staticId();"; + } } } out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __len" << iter << "; __i" << iter @@ -1295,7 +1305,8 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out, else { bool isObject = false; - if((b && b->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(origContent)) + ClassDeclPtr cl = ClassDeclPtr::dynamicCast(origContent); + if((b && b->kind() == Builtin::KindObject) || cl) { isObject = true; } @@ -1309,7 +1320,16 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out, } else { - out << nl << "final String __type" << iter << " = " << origContentS << ".ice_staticId();"; + assert(cl); + if(cl->isInterface()) + { + out << nl << "final String __type" << iter << " = " + << getAbsolute(cl, package, "_", "Disp") << ".ice_staticId();"; + } + else + { + out << nl << "final String __type" << iter << " = " << origContentS << ".ice_staticId();"; + } } } out << nl << v << " = new " << origContentS << "[__len" << iter << "]"; @@ -1410,7 +1430,7 @@ bool Slice::JavaGenerator::MetaDataVisitor::visitModuleStart(const ModulePtr& p) { validate(p); - return false; + return true; } void -- cgit v1.2.3