Repository: reef Updated Branches: refs/heads/master 5ed146d2d -> 9e07de6b6
[REEF-1333] Type cast warnings in our C++ code This change: * Removes the `InteropReturnInfo` class as it was not used. As a by-product, this also removes the build warnings. JIRA: [REEF-1333](https://issues.apache.org/jira/browse/REEF-1001) Pull Request: Closes #24 Project: http://git-wip-us.apache.org/repos/asf/reef/repo Commit: http://git-wip-us.apache.org/repos/asf/reef/commit/9e07de6b Tree: http://git-wip-us.apache.org/repos/asf/reef/tree/9e07de6b Diff: http://git-wip-us.apache.org/repos/asf/reef/diff/9e07de6b Branch: refs/heads/master Commit: 9e07de6b6fe8aef06a00b6ca238d9d833af515c4 Parents: 5ed146d Author: Adrian Nicoara <[email protected]> Authored: Thu May 12 14:07:15 2016 -0700 Committer: Andrew Chung <[email protected]> Committed: Tue May 17 14:01:18 2016 -0700 ---------------------------------------------------------------------- .../InteropReturnInfo.cpp | 89 -------------------- .../Org.Apache.REEF.Bridge/InteropReturnInfo.h | 58 ------------- .../cs/Org.Apache.REEF.Bridge/JavaClrBridge.cpp | 1 - .../Org.Apache.REEF.Bridge.vcxproj | 4 +- .../Org.Apache.REEF.Bridge.vcxproj.filters | 6 -- .../Bridge/IInteropReturnInfo.cs | 29 ------- .../Org.Apache.REEF.Driver.csproj | 1 - .../reef/javabridge/InteropReturnInfo.java | 60 ------------- 8 files changed, 1 insertion(+), 247 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/reef/blob/9e07de6b/lang/cs/Org.Apache.REEF.Bridge/InteropReturnInfo.cpp ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Bridge/InteropReturnInfo.cpp b/lang/cs/Org.Apache.REEF.Bridge/InteropReturnInfo.cpp deleted file mode 100644 index 815d446..0000000 --- a/lang/cs/Org.Apache.REEF.Bridge/InteropReturnInfo.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#include "InteropReturnInfo.h" - -namespace Org { - namespace Apache { - namespace REEF { - namespace Bridge { - // currently not being used - InteropReturnInfo::InteropReturnInfo( - JNIEnv* env, - jobject jobjectInteropReturnInfo, - ILogger^ logger - ) { - _env = env; - _jobjectInteropReturnInfo = jobjectInteropReturnInfo; - jclass thisClass = env->GetObjectClass(jobjectInteropReturnInfo); - wchar_t formatBuf[1024]; - - swprintf_s(formatBuf, sizeof(formatBuf) / sizeof(wchar_t), L"zzzzzzz this should be printed by java jmid 00 %p\n", thisClass); - logger->Log(TraceLevel::Error, gcnew String(formatBuf)); - _jmidAddExceptionString = env->GetMethodID(thisClass, "addExceptionString", "(Ljava/lang/String;)V"); - if (NULL == _jmidAddExceptionString) { - swprintf_s(formatBuf, sizeof(formatBuf) / sizeof(wchar_t), L"_jmidAddExceptionString %p\n", _jmidAddExceptionString); - fwprintf(stdout, formatBuf); - fflush(stdout); - } - - _jmidHasExceptions = env->GetMethodID(thisClass, "hasExceptions", "()Z"); - if (NULL == _jmidHasExceptions) { - swprintf_s(formatBuf, sizeof(formatBuf) / sizeof(wchar_t), L"_jmidHasExceptions %p\n", _jmidHasExceptions); - fwprintf(stdout, formatBuf); - fflush(stdout); - } - - _jmidsetReturnCode = env->GetMethodID(thisClass, "setReturnCode", "(I)V"); - if (NULL == _jmidsetReturnCode) { - swprintf_s(formatBuf, sizeof(formatBuf) / sizeof(wchar_t), L"_jmidsetReturnCode %p\n", _jmidsetReturnCode); - fwprintf(stdout, formatBuf); - fflush(stdout); - } - - _jmidgetReturnCode = env->GetMethodID(thisClass, "getReturnCode", "()I"); - if (NULL == _jmidgetReturnCode) { - swprintf_s(formatBuf, sizeof(formatBuf) / sizeof(wchar_t), L"_jmidgetReturnCode %p\n", _jmidgetReturnCode); - fwprintf(stdout, formatBuf); - fflush(stdout); - } - } - - void InteropReturnInfo::AddExceptionString(String^ exceptionString) { - HasExceptions(); - pin_ptr<const wchar_t> wch = PtrToStringChars(exceptionString); - jstring ret = _env->NewString((const jchar*)wch, exceptionString->Length); - _env->CallObjectMethod(_jobjectInteropReturnInfo, _jmidAddExceptionString, ret); - HasExceptions(); - } - - Boolean InteropReturnInfo::HasExceptions() { - jobject obj = _env->CallObjectMethod(_jobjectInteropReturnInfo, _jmidHasExceptions); - return obj != NULL; - } - void InteropReturnInfo::SetReturnCode(int rc) { - _env->CallObjectMethod(_jobjectInteropReturnInfo, _jmidsetReturnCode, rc); - GetReturnCode(); - } - int InteropReturnInfo::GetReturnCode() { - jobject obj = _env->CallObjectMethod(_jobjectInteropReturnInfo, _jmidgetReturnCode); - return (int)obj; - } - } - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/reef/blob/9e07de6b/lang/cs/Org.Apache.REEF.Bridge/InteropReturnInfo.h ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Bridge/InteropReturnInfo.h b/lang/cs/Org.Apache.REEF.Bridge/InteropReturnInfo.h deleted file mode 100644 index 83a2e8c..0000000 --- a/lang/cs/Org.Apache.REEF.Bridge/InteropReturnInfo.h +++ /dev/null @@ -1,58 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#include "InteropUtil.h" -#include "org_apache_reef_javabridge_NativeInterop.h" -#include "JavaClrBridge.h" -#include "InteropAssemblies.h" -#using "Org.Apache.REEF.Driver.dll" - -using namespace System; -using namespace System::IO; -using namespace System::Collections::Generic; -using namespace System::Runtime::InteropServices; -using namespace System::Reflection; -using namespace Org::Apache::REEF::Driver::Bridge; - -namespace Org { - namespace Apache { - namespace REEF { - namespace Bridge { - public ref class InteropReturnInfo : public IInteropReturnInfo { - JNIEnv* _env; - jobject _jobjectInteropReturnInfo; - - jmethodID _jmidAddExceptionString; - jmethodID _jmidHasExceptions; - jmethodID _jmidsetReturnCode; - jmethodID _jmidgetReturnCode; - - public: - InteropReturnInfo( - JNIEnv* env, - jobject jobjectInteropReturnInfo, - ILogger^ logger - ); - virtual void AddExceptionString(String^ exceptionString); - virtual Boolean HasExceptions(); - virtual void SetReturnCode(int rc); - virtual int GetReturnCode(); - }; - } - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/reef/blob/9e07de6b/lang/cs/Org.Apache.REEF.Bridge/JavaClrBridge.cpp ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Bridge/JavaClrBridge.cpp b/lang/cs/Org.Apache.REEF.Bridge/JavaClrBridge.cpp index a54cd7b..f5950aa 100644 --- a/lang/cs/Org.Apache.REEF.Bridge/JavaClrBridge.cpp +++ b/lang/cs/Org.Apache.REEF.Bridge/JavaClrBridge.cpp @@ -19,7 +19,6 @@ #include "org_apache_reef_javabridge_NativeInterop.h" #include "JavaClrBridge.h" #include "InteropAssemblies.h" -#include "InteropReturnInfo.h" #include "Clr2JavaImpl.h" #include "InteropLogger.h" #include "BinaryUtil.h" http://git-wip-us.apache.org/repos/asf/reef/blob/9e07de6b/lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.vcxproj ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.vcxproj b/lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.vcxproj index 60e8f59..a688c44 100644 --- a/lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.vcxproj +++ b/lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.vcxproj @@ -60,7 +60,7 @@ under the License. </PropertyGroup> <!-- End of: Switch the PlatformToolset based on the Visual Studio Version - --> + --> <PropertyGroup> <!-- Auto generate binding redirects to make sure the latest Newtonsoft JSON is picked up --> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> @@ -138,7 +138,6 @@ under the License. <ClInclude Include="Clr2JavaImpl.h" /> <ClInclude Include="InteropAssemblies.h" /> <ClInclude Include="InteropLogger.h" /> - <ClInclude Include="InteropReturnInfo.h" /> <ClInclude Include="InteropUtil.h" /> <ClInclude Include="JavaClrBridge.h" /> <ClInclude Include="resource.h" /> @@ -164,7 +163,6 @@ under the License. <ClCompile Include="FailedTaskClr2Java.cpp" /> <ClCompile Include="HttpServerClr2Java.cpp" /> <ClCompile Include="InteropLogger.cpp" /> - <ClCompile Include="InteropReturnInfo.cpp" /> <ClCompile Include="InteropUtil.cpp" /> <ClCompile Include="JavaClrBridge.cpp" /> <ClCompile Include="RunningTaskClr2Java.cpp" /> http://git-wip-us.apache.org/repos/asf/reef/blob/9e07de6b/lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.vcxproj.filters ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.vcxproj.filters b/lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.vcxproj.filters index a59888c..c690e63 100644 --- a/lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.vcxproj.filters +++ b/lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.vcxproj.filters @@ -33,9 +33,6 @@ <ClInclude Include="InteropLogger.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="InteropReturnInfo.h"> - <Filter>Header Files</Filter> - </ClInclude> <ClInclude Include="InteropUtil.h"> <Filter>Header Files</Filter> </ClInclude> @@ -95,9 +92,6 @@ <ClCompile Include="InteropLogger.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="InteropReturnInfo.cpp"> - <Filter>Source Files</Filter> - </ClCompile> <ClCompile Include="InteropUtil.cpp"> <Filter>Source Files</Filter> </ClCompile> http://git-wip-us.apache.org/repos/asf/reef/blob/9e07de6b/lang/cs/Org.Apache.REEF.Driver/Bridge/IInteropReturnInfo.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Driver/Bridge/IInteropReturnInfo.cs b/lang/cs/Org.Apache.REEF.Driver/Bridge/IInteropReturnInfo.cs deleted file mode 100644 index d244860..0000000 --- a/lang/cs/Org.Apache.REEF.Driver/Bridge/IInteropReturnInfo.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; - -namespace Org.Apache.REEF.Driver.Bridge -{ - public interface IInteropReturnInfo - { - void AddExceptionString(string exceptionString); - bool HasExceptions(); - void SetReturnCode(int rc); - int GetReturnCode(); - } -} http://git-wip-us.apache.org/repos/asf/reef/blob/9e07de6b/lang/cs/Org.Apache.REEF.Driver/Org.Apache.REEF.Driver.csproj ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Driver/Org.Apache.REEF.Driver.csproj b/lang/cs/Org.Apache.REEF.Driver/Org.Apache.REEF.Driver.csproj index eebca2c..a9a91a1 100644 --- a/lang/cs/Org.Apache.REEF.Driver/Org.Apache.REEF.Driver.csproj +++ b/lang/cs/Org.Apache.REEF.Driver/Org.Apache.REEF.Driver.csproj @@ -93,7 +93,6 @@ under the License. <Compile Include="Bridge\HttpServerPort.cs" /> <Compile Include="Bridge\IHttpHandler.cs" /> <Compile Include="Bridge\IHttpMessage.cs" /> - <Compile Include="Bridge\IInteropReturnInfo.cs" /> <Compile Include="Bridge\ILogger.cs" /> <Compile Include="Bridge\ReefHttpRequest.cs" /> <Compile Include="Bridge\ReefHttpResponse.cs" /> http://git-wip-us.apache.org/repos/asf/reef/blob/9e07de6b/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/InteropReturnInfo.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/InteropReturnInfo.java b/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/InteropReturnInfo.java deleted file mode 100644 index dc1baef..0000000 --- a/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/InteropReturnInfo.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.reef.javabridge; - -import org.apache.reef.annotations.audience.Interop; -import org.apache.reef.annotations.audience.Private; - -import java.util.ArrayList; - -/** - * Information about return codes/exceptions coming from bridge. - */ -@Private -@Interop(CppFiles = { "InteropReturnInfo.cpp", "InteropReturnInfo.cs"}, CsFiles = { "IInteropReturnInfo.cs" }) -public final class InteropReturnInfo { - - private int returnCode; - private ArrayList<String> exceptionList = new ArrayList<>(); - - public void addExceptionString(final String exceptionString) { - exceptionList.add(exceptionString); - } - - public boolean hasExceptions() { - return !exceptionList.isEmpty(); - } - - public ArrayList<String> getExceptionList() { - return exceptionList; - } - - public int getReturnCode() { - return returnCode; - } - - public void setReturnCode(final int rc) { - returnCode = rc; - } - - public void reset() { - exceptionList = new ArrayList<String>(); - returnCode = 0; - } -}
