JDK-6642405 : src/share/instrument/JPLISAgent.c line 286: "==" found where assignment "=" expected
  • Type: Bug
  • Component: core-svc
  • Sub-Component: tools
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2007-12-16
  • Updated: 2014-04-14
  • Resolved: 2011-04-19
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 6 JDK 7
6u81Fixed 7 b26Fixed
Description
Running lint on the make/java/instrument code:

cd <your workspace>/jdk/make/java/instrument
gmake lint.clean
gmake lint.errors

  [...]
/devtools/sparc/SUNWspro/SS11/bin/lint  -errsecurity=core -errhdr=%user -v -x  -u -errfmt=simple  -Xarch=v8   -DTRIMMED -DNO_JPLIS_LOGGING -Dsparc -D__solaris__ -D_REENTRANT  -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS -I. -I../../../build/solaris-sparc/tmp/sun/sun.instrument/instrument/CClassHeaders -I../../../src/solaris/javavm/export -I../../../src/share/javavm/export -I../../../src/share/javavm/include -I../../../src/solaris/javavm/include -I../../../src/share/instrument -I../../../src/solaris/instrument -I../../../src/solaris/native/java/io -I../../../src/share/bin -I../../../src/solaris/bin -I../../../src/share/native/common -I../../../src/solaris/native/common -I../../../src/share/native/sun/instrument -I../../../src/solaris/native/sun/instrument    -dirout=../../../build/solaris-sparc/tmp/sun/sun.instrument/instrument/obj -c ../../../src/share/instrument/JPLISAgent.c
illegal option -Xarch=v8
"../../../src/share/instrument/JPLISAgent.c", line 286 [16]: warning: expression, or sub-expression, has null effect
"../../../src/share/instrument/JPLISAgent.c", line 286 [16]: warning: equality operator "==" found where assignment "=" expected



   277      jvmtierror = (*jvmtienv)->SetEnvironmentLocalStorage(
   278                                              jvmtienv,
   279                                              &(agent->mNormalEnvironment));
   280      jplis_assert(jvmtierror == JVMTI_ERROR_NONE);
   281
   282      /* check what capabilities are available */
   283      checkCapabilities(agent);
   284
   285      /* check phase - if live phase then we don't need the VMInit event */
   286      jvmtierror == (*jvmtienv)->GetPhase(jvmtienv, &phase);
   287      jplis_assert(jvmtierror == JVMTI_ERROR_NONE);
   288      if (phase == JVMTI_PHASE_LIVE) {
   289          return JPLIS_INIT_ERROR_NONE;
   290      }
   291
   292      /* now turn on the VMInit event */
   293      if ( jvmtierror == JVMTI_ERROR_NONE ) {
   294          jvmtiEventCallbacks callbacks;

Statement 286 should be an assignment.
The assert at 287 is not checking the results of the GetPhase() call.
The code works most of the time because GetPhase() is successful and sets &phase as a side-effect.

Comments
SUGGESTED FIX Simple one character deletion so no webrev. Here are the context diffs: ------- src/share/instrument/JPLISAgent.c ------- *** /tmp/sccs.afaaDY Tue Feb 5 22:17:38 2008 --- JPLISAgent.c Tue Feb 5 22:17:31 2008 *************** *** 283,289 **** checkCapabilities(agent); /* check phase - if live phase then we don't need the VMInit event */ ! jvmtierror == (*jvmtienv)->GetPhase(jvmtienv, &phase); jplis_assert(jvmtierror == JVMTI_ERROR_NONE); if (phase == JVMTI_PHASE_LIVE) { return JPLIS_INIT_ERROR_NONE; --- 283,289 ---- checkCapabilities(agent); /* check phase - if live phase then we don't need the VMInit event */ ! jvmtierror = (*jvmtienv)->GetPhase(jvmtienv, &phase); jplis_assert(jvmtierror == JVMTI_ERROR_NONE); if (phase == JVMTI_PHASE_LIVE) { return JPLIS_INIT_ERROR_NONE;
06-02-2008

EVALUATION I took a quick look at src/share/instrument/JPLISAgent.c: D 1.35 07/10/17 12:31:56 ohair 45 44 00171/00171/01291 MRs: COMMENTS: 6616089: Whitespace cleanup on all sources and the errant line 286 is still there.
31-01-2008

SUGGESTED FIX Change: 286 jvmtierror == (*jvmtienv)->GetPhase(jvmtienv, &phase); to: 286 jvmtierror = (*jvmtienv)->GetPhase(jvmtienv, &phase); as suggested by the submitter.
31-01-2008