JDK-8183928 : [Linux] Remove Warnings [-Wunused-parameter]
  • Type: Bug
  • Component: javafx
  • Sub-Component: web
  • Affected Version: 10
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2017-07-06
  • Updated: 2020-01-31
  • Resolved: 2017-09-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10 JDK 8
10Fixed 8u171Fixed
Description
/rt/modules/javafx.web/src/main/native/Source/WebCore/platform/java/FrameLoaderClientJava.cpp:332:118: warning: unused parameter ���request��� [-Wunused-parameter]
 void FrameLoaderClientJava::dispatchDecidePolicyForResponse(const ResourceResponse& response, const ResourceRequest& request, FramePolicyFunction policyFunction)

/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/platform/java/DragDataJava.cpp:20:53: warning: unused parameter ���filenamePolicy��� [-Wunused-parameter]
 bool DragData::containsURL(FilenameConversionPolicy filenamePolicy /*= ConvertFilenames*/) const

/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/platform/java/DragDataJava.cpp:27:49: warning: unused parameter ���filenamePolicy��� [-Wunused-parameter]
 String DragData::asURL(FilenameConversionPolicy filenamePolicy, String* title) const
                                                 ^
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/page/java/DragControllerJava.cpp:35:56: warning: unused parameter ���dragData��� [-Wunused-parameter]
     bool DragController::isCopyKeyDown(const DragData& dragData)

[ 11%] Building CXX object Source/WTF/wtf/CMakeFiles/WTF.dir/java/JavaEnv.cpp.o
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WTF/wtf/java/JavaEnv.cpp:244:53: warning: unused parameter ���reserved��� [-Wunused-parameter]
 JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved)
                                                     ^
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WTF/wtf/java/JavaEnv.cpp:263:45: warning: unused parameter ���vm��� [-Wunused-parameter]
 JNIEXPORT void JNICALL JNI_OnUnload(JavaVM* vm, void* reserved)
                                             ^
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WTF/wtf/java/JavaEnv.cpp:263:55: warning: unused parameter ���reserved��� [-Wunused-parameter]
 JNIEXPORT void JNICALL JNI_OnUnload(JavaVM* vm, void* reserved)

/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp: At global scope:
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:376:22: warning: unused parameter ���clas��� [-Wunused-parameter]
 (JNIEnv *env, jclass clas, jlong peer, jint peer_type, jint index, jobject value, jobject accessControlContext)
                      ^
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:388:22: warning: unused parameter ���clas��� [-Wunused-parameter]
 (JNIEnv *env, jclass clas, jlong peer, jint peer_type)
                      ^
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp: In function ���_jobject* Java_com_sun_webkit_dom_JSObject_callImpl(JNIEnv*, jclass, jlong, jint, jstring, jobjectArray, jobject)���:
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:425:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0;  i < argumentCount; i++) {
                        ^
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp: At global scope:
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:442:10: warning: unused parameter ���env��� [-Wunused-parameter]
 (JNIEnv *env, jclass clas, jlong peer, jint peer_type)
          ^
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:442:22: warning: unused parameter ���clas��� [-Wunused-parameter]
 (JNIEnv *env, jclass clas, jlong peer, jint peer_type)
                      ^
[ 96%] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir/bridge/jni/jsc/JavaInstanceJSC.cpp.o
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:55:15: warning: ���_jclass* getNodeImplClass(JNIEnv*)��� defined but not used [-Wunused-function]
 static jclass getNodeImplClass (JNIEnv *env)
               ^
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:65:15: warning: ���_jclass* getDoubleClass(JNIEnv*)��� defined but not used [-Wunused-function]
 static jclass getDoubleClass (JNIEnv *env)
               ^
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:70:15: warning: ���_jclass* getIntegerClass(JNIEnv*)��� defined but not used [-Wunused-function]
 static jclass getIntegerClass (JNIEnv *env)

/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp: In function ���const OpaqueJSValue* WebCore::Java_Object_to_JSValue(JNIEnv*, JSContextRef, JSC::Bindings::RootObject*, jobject, jobject)���:
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:130:24: warning: unused variable ���jobject��� [-Wunused-variable]
         JSC::JSObject *jobject = 0;
                        ^


/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:196:13: warning: unused parameter ���env��� [-Wunused-parameter]
     JNIEnv* env,
             ^
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:297:22: warning: unused parameter ���clas��� [-Wunused-parameter]
 (JNIEnv *env, jclass clas, jlong peer, jint peer_type, jstring str)
                      ^
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:311:22: warning: unused parameter ���clas��� [-Wunused-parameter]
 (JNIEnv *env, jclass clas, jlong peer, jint peer_type, jstring str)
                      ^
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:328:22: warning: unused parameter ���clas��� [-Wunused-parameter]
 (JNIEnv *env, jclass clas, jlong peer, jint peer_type, jstring str, jobject value, jobject accessControlContext)
                      ^
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:349:22: warning: unused parameter ���clas��� [-Wunused-parameter]
 (JNIEnv *env, jclass clas, jlong peer, jint peer_type, jstring str)
                      ^
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:365:24: warning: unused parameter ���clas��� [-Wunused-parameter]
   (JNIEnv *env, jclass clas, jlong peer, jint peer_type, jint index)
                        ^
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp: In function ���void Java_com_sun_webkit_dom_JSObject_setSlotImpl(JNIEnv*, jclass, jlong, jint, jint, jobject, jobject)���:
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:383:26: warning: unused variable ���attributes��� [-Wunused-variable]
     JSPropertyAttributes attributes = 0;
                          ^
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp: At global scope:
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:376:22: warning: unused parameter ���clas��� [-Wunused-parameter]
 (JNIEnv *env, jclass clas, jlong peer, jint peer_type, jint index, jobject value, jobject accessControlContext)
                      ^
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:388:22: warning: unused parameter ���clas��� [-Wunused-parameter]
 (JNIEnv *env, jclass clas, jlong peer, jint peer_type)
                      ^
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp: In function ���_jobject* Java_com_sun_webkit_dom_JSObject_callImpl(JNIEnv*, jclass, jlong, jint, jstring, jobjectArray, jobject)���:
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:425:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0;  i < argumentCount; i++) {
                        ^
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp: At global scope:
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:442:10: warning: unused parameter ���env��� [-Wunused-parameter]
 (JNIEnv *env, jclass clas, jlong peer, jint peer_type)
          ^
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:442:22: warning: unused parameter ���clas��� [-Wunused-parameter]
 (JNIEnv *env, jclass clas, jlong peer, jint peer_type)
                      ^
[ 96%] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir/bridge/jni/jsc/JavaInstanceJSC.cpp.o
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:55:15: warning: ���_jclass* getNodeImplClass(JNIEnv*)��� defined but not used [-Wunused-function]
 static jclass getNodeImplClass (JNIEnv *env)
               ^
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:65:15: warning: ���_jclass* getDoubleClass(JNIEnv*)��� defined but not used [-Wunused-function]
 static jclass getDoubleClass (JNIEnv *env)
               ^
/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:70:15: warning: ���_jclass* getIntegerClass(JNIEnv*)��� defined but not used [-Wunused-function]
 static jclass getIntegerClass (JNIEnv *env)

/home/murali/10-sandbox/jfx/rt/modules/javafx.web/src/main/native/Source/WebCore/platform/java/ContextMenuClientJava.cpp:24:52: warning: unused parameter ���url��� [-Wunused-parameter]
 void ContextMenuClientJava::downloadURL(const URL& url)                                                       ^

Comments
Changeset: 4b61726fdc1e Author: mbilla Date: 2017-09-14 11:45 +0530 URL: http://hg.openjdk.java.net/openjfx/10-dev/rt/rev/4b61726fdc1e
14-09-2017

+1
31-08-2017

I wasn't really worried in this specific case. It seems fine to me. I'm just pointing out that in general you should always look at what the method you are removing the call to does, in case there are needed side-effects of the call.
16-08-2017

I tested live sites in HelloWebView with above webrev and i don't see any side effects for image rendering. In this case, "env" is not being used in "drawImage" API unlike other API's in ImageJava.cpp
16-08-2017

modules/javafx.web/src/main/native/Source/WebCore/platform/graphics/java/ImageJava.cpp - JNIEnv* env = WebCore_GetJavaEnv(); Are you sure that removing this function call is behavior neutral? I guess so in this case, but in general it is good to check that there is no side-effect of calling the function that is being relied upon.
16-08-2017

webrev (without bindings correction): http://cr.openjdk.java.net/~mbilla/8183928/webrev.01/ If we find/replace for bindings, out of 1800 corrections, 400 instances are unused parameters and 1400 instances are actually used parameters. So it involves more manual effort to correct compilation issues at 1400 instances, where the variable is actually used. So it is better to correct manually at ~400 unused places instead of find/replace.
14-08-2017

>> I didnt removed the warnings from bindings and JNI calls (as there are too many) I think it is better to address all warnings in this bug itself. If it is too many try find/replace in directory level.
09-08-2017

[~ghb] IMO, i feel better not to suppress these warnings, as at some places we have really unused variables decalred in Platform Specific files(mentioned below). May be just commenting the parameter names is better in this case (to preserve the information) ? for ex: 1. BackForwardList.cpp JNIEXPORT jobject JNICALL Java_com_sun_webkit_BackForwardList_bflItemGetIcon(JNIEnv* env, jclass z, jlong jitem) { HistoryItem* item = getItem(jitem); //un-used 2. BridgeUtils.cpp JSValueRef Java_Object_to_JSValue( JSC::JSObject *jobject = 0; // un-used 3. ImageJava.cpp JNIEnv* env = WebCore_GetJavaEnv() ; // un-used More info on un-used Parameter [1]: [1] https://stackoverflow.com/questions/308277/what-are-the-consequences-of-ignoring-warning-unused-parameter
09-08-2017

ChromiumBridge.cpp : void ChromiumBridge::plugins(bool /* refresh */, Vector<PluginInfo>*) FontCacheJava.cpp : 58 const AtomicString& FontCache::platformAlternateFamilyName(const AtomicString& /* familyName */ ) FontJava.cpp : No code change, only extra line added, you can ignore this file FileSystemJava.cpp : bool getFileCreationTime(const String&, time_t& /* result */) listDirectory(const String& path, const String& filter) openFile(const String& path, FileOpenMode mode) Murali : These modifed files are specific to our platform, Lets suppress the warning at file level rather than removing argments which looses its value (as mentioned above). // FIXME: Remove these below once we have fully implement unsupported features. #if COMPILER(GCC_OR_CLANG) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmissing-noreturn" #pragma GCC diagnostic ignored "-Wunused-parameter" #endif // COMPILER(GCC_OR_CLANG) Or This might cause build failure on Windows , as i tested with OS X #pragma GCC diagnostic ignored "-Wunused-parameter"
09-08-2017

Seems OK then if you've thought about it and it is a deliberate decision.
08-08-2017

Thanks [~kcr]..Agree with your opinion that we may loose semantic information.. Actually 2 primary reasons why i removed the variable names are: 1. While porting, we already removed the unused variable names at few places and i tried to make it uniform across Java Porting layer 2. At few functions where we have multiple (unused )parameters, for few parameters we have names and for others we don't have. For ex: void ChromiumBridge::plugins(bool refresh, Vector<PluginInfo>*)
08-08-2017

I'll defer the review to Arun or Guru. My only comment is that several of the unused parameters are resolved by removing the name of the parameter. While this will address the warning, it also loses some information. Perhaps you might consider commenting the name out instead? Just a suggestion.
08-08-2017

webrev: http://cr.openjdk.java.net/~mbilla/8183928/webrev.00/ I didnt removed the warnings from bindings and JNI calls (as there are too many) For ex: linux-amd64-91/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/BridgeUtils.cpp:196:13: warning: unused parameter 'env' [-Wunused-parameter] JNIEnv* env, ^ /linux-amd64-91/rt/modules/javafx.web/src/main/native/Source/WebCore/platform/graphics/java/ImageJava.cpp:65:13: warning: unused variable 'env' [-Wunused-variable] JNIEnv* env = WebCore_GetJavaEnv(); linux-amd64-91/rt/modules/javafx.web/src/main/native/Source/WebKit/java/BackForwardList.cpp:173:97: warning: unused parameter 'z' [-Wunused-parameter] JNIEXPORT jstring JNICALL Java_com_sun_webkit_BackForwardList_bflItemGetURL(JNIEnv* env, jclass z, jlong jitem) linux-amd64-91/rt/modules/javafx.web/src/main/native/Source/WebCore/bindings/java/dom3/JavaCSSRule.cpp:45:76: warning: unused parameter 'env' [-Wunused-parameter] JNIEXPORT void JNICALL Java_com_sun_webkit_dom_CSSRuleImpl_dispose(JNIEnv* env, jclass, jlong peer)
07-08-2017

Removing multiple fixVersions (by policy we never have more than one fix version on a JBS issue).
25-07-2017