This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 94242 - Apply Code Changes menu item does not work
Summary: Apply Code Changes menu item does not work
Status: CLOSED WONTFIX
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 5.x
Hardware: PC Windows XP
: P3 blocker with 1 vote (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-03 02:34 UTC by bugbridge
Modified: 2010-04-29 09:32 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bugbridge 2007-02-03 02:34:47 UTC
Description:
Steps to reproduce:

1) Create a new project
2) Insert a statement in the Page1 page bean constructor and add a breakpoint to it.
3) Deploy in debug mode
4) After the program stalls at the breakpoint, insert another statement after
the breakpoint and select Run/Apply Code Changes.
5) Output reports 'build failed' and application seems to have shut down.

Description (Entry 2):
NOTE to Marco: Temporarily removing the waiver due to the fact that Quality
Council more information as to when this happens and what the customer impact
is.  Please provide this information as add the WAV keyword back to the bug.

Description (Entry 3):
This is approved for waiver as long as the option is greyed or removed.  Mark
Dey will follow up on this.

Evaluation:
Looks like a regression from insync.

Evaluation (Entry 2):
init:
deps-module-jar:
deps-ear-jar:
deps-jar:
Compiling 1 source file to C:\Documents and Settings\Po-Ting Wu\My
Documents\Creator\Projects\WebApplication34\build\web\WEB-INF\classes
compile-single:
Classes to be reloaded:
 webapplication34.Page1
C:\Documents and Settings\Po-Ting Wu\My
Documents\Creator\Projects\WebApplication34\nbproject\build-impl.xml:484: The
following error occurred while executing this line:
C:\Documents and Settings\Po-Ting Wu\My
Documents\Creator\Projects\WebApplication34\nbproject\build-impl.xml:186:
com.sun.jdi.InternalException: Unexpected JDWP Error: 32
BUILD FAILED (total time: 0 seconds)

Evaluation (Entry 3):
I don't know with which JVM the original bug was filed. But I  tried to
reproduce it with 1.5.0_04-b05 andd get interesting results:

* On an empty page I can fix & continue and eveything seems to workk as it
should. But it's not very useful.

* On a page with a StaticText I run into problems recompiling after my update. I
don't
believe anything (of the fix&continue) has hit the AppServer yet.

The Output for the StaticText case:
---------------------------------------------------------------------
init:
deps-module-jar:
deps-ear-jar:
deps-jar:
Compiling 1 source file to
/export/home/marcow/Creator/Projects/debug2/build/web/WEB-INF/classes
compile-single:
Classes to be reloaded:
 debug2.Page1
/export/home/marcow/Creator/Projects/debug2/nbproject/build-impl.xml:484: The
following error occurred while executing this line:
/export/home/marcow/Creator/Projects/debug2/nbproject/build-impl.xml:186:
java.lang.UnsupportedOperationException: schema change not implemented
BUILD FAILED (total time: 0 seconds)
-------------------------------------------------------------------------

The `schema change not implemented' seems to come out of the JDK's tools.jar.

Eric, do you have any idea on that?

Evaluation (Entry 4):
Ok, I looked at it again. And the fix&continue seems to work with the new JVM.

But only for very minor fixes. For bigger changes (like adding an automatic
variable to a method the com.sun.tools.jdi.VirtualMachineImpl will throw the
execeptions which I reported previously. That looks like a JVM implementation.

I'll mark this bug as fixed. (but the usefulness is limited!)

Evaluation (Entry 5):
It looks like the problem on XP still exists:-( So there is a difference
possibly caused by the debug-transport mechanism:-( On Linux/Unix we use
tcp/port based transport, on Windows we use shared_memory transport.

But I can't do anything here:-( I filed a bug for the JVM, but I don't know what
we will find out. All this code is either NB unchanged or JVM.

Evaluation (Entry 6):
We will remove this feature from the debugger tutorial.

Evaluation (Entry 7):
I think we found the problem in `our use of Java beans' and the JVM's handling
of it. The JVM uses native methods to do the reflection calls, but then it can't
handle the popFrame on those native methods.

The JVM has opened CR 6333572 on that.

---------------------------------------------------------------------
Sundar says:

Reflective calls (Constructor.newInstance
and Method.invoke) go through native mechanism upto a threashold
number of calls. If the same Constructor/Method is reflectively called
more than the threshold number of times, then reflection speed-up
classes are generated and loaded. These speed-up classes will then
make direct calls (invokespecial/invokevirtual). The default value of
this threshold is 15. There is an undocumented System property by
which this can be changed. There is also another undocumented system
property to completely switch off this thresholding (known as
"inflation") process. The inflation process is done to avoid startup
penalty on applications that use heavy reflection code. 

The interger valued system property
"sun.reflection.inflationThreshold" can be set to change the default
of 15. (but no, setting it to '0' does not work-- with inflation,
native access is used atleast once). But, the boolean system property
"sun.reflection.noInflation" controls whether native access is used at
all. Default of this is false. If set to true, first reflective call
will generate speed-up bytecode. If you don't want to have native
reflective access at all (and accept the startup cost-- which I guess
is fine in development environments), you can set this property. That
may workaround the popframe issue.  

May be, should we consider doing this by default depending on the JVM
TI capabilities?
-------------------------------------------------------------------------

I tried to add that property in our wrapper around the PEMain class when it's
running as `debugging enabled' but that does not seem to work as expected:-( 

So we can only waive that for now:-( [Maybe we should even remove/disable the
action completely?]

Evaluation (Entry 8):
Bug 6335653 has been filed to remove the feature for Thresher.

Workaround:
-
Comment 1 Mark Dey 2007-04-28 03:06:46 UTC
Assigning to insync for evaluation. 
Comment 2 _ sandipchitale 2007-05-17 00:03:37 UTC
I am now getting this when I try to push the changes using Apply Code Changes:

init:
deps-module-jar:
deps-ear-jar:
deps-jar:
Compiling 1 source file to C:\Documents and Settings\sc32560\My 
Documents\NetBeansProjects\WebApplication6\build\web\WEB-INF\classes
compile-single:
Classes to be reloaded:
 webapplication6.Page1
The virtual machine does not support this operation: schema change not 
implemented
C:\Documents and Settings\sc32560\My Documents\NetBeansProjects\WebApplication6
\nbproject\build-impl.xml:640: The following error occurred while executing 
this line:
C:\Documents and Settings\sc32560\My Documents\NetBeansProjects\WebApplication6
\nbproject\build-impl.xml:214: The virtual machine does not support this 
operation: schema change not implemented
BUILD FAILED (total time: 0 seconds)


The About Box has:

NetBeans IDE Dev (Build 070516)
1.5.0_11; Java HotSpot(TM) Client VM 1.5.0_11-b03
Windows XP version 5.1 running on x86
en_US (nb); Cp1252

Assigning to Po-ting for further evaluation.
Comment 3 _ potingwu 2008-02-26 20:05:51 UTC
I have done more investigation on NetBeans 6.1 and found it's now working correctly.
Comment 4 _ potingwu 2008-02-26 20:15:55 UTC
Actually it works under NetBeans 6.0 as well.
Comment 5 jsr 2008-02-29 18:18:24 UTC
Can you explain further how this is currently working on 6.0? Just today I saw the "schema change not implemented" error
after doing an "Apply Code Changes" in 6.0.1. Even after redeploying the application the Apply Code Changes button does
not work for that page. It will not work for that page again until the IDE is restarted. It does work for other pages
though. 
Comment 6 _ potingwu 2008-07-22 19:49:39 UTC
It works under the current trunk.
Comment 7 jsr 2008-07-22 20:28:27 UTC
The following scenario was tested with both 6.1 and 20080722 on Windows XP SP3, 1.6.0_07 and Glassfish V2 UR2.

1. Create a new VWP Project
2. Drag a Text Field component onto the new page
3. Debug Main Project (CTRL-F5)
4. Right click on the text box and select "Add Binding Attribute"
5. Click on the Java tab to switch to the java source
6. Click the Apply Code Changes button

This error message is generated (with 20080722):

The virtual machine does not support this operation: schema change not implemented
C:\NetBeansProjects\WebApplication3\nbproject\build-impl.xml:673: The following error occurred while executing this line:
C:\NetBeansProjects\WebApplication3\nbproject\build-impl.xml:287: The virtual machine does not support this operation:
schema change not implemented
BUILD FAILED (total time: 0 seconds)


After these steps, the Apply Code Changes button will no longer work for any changes done to that file until either the
IDE or Glassfish is restarted. Redeploying the application does not help.

I realize that this feature is only meant for minor changes (whatever that means) and maybe adding a binding attribute
is too big of a change, however that should not stop the button from ever working with that file again until the IDE is
restarted. The button should work again once the application is redeployed.
Comment 8 _ potingwu 2008-07-22 21:06:16 UTC
Passing to debugger because Visual Web does not directly handle this feature.
Comment 9 Martin Entlicher 2008-07-22 23:04:20 UTC
It does what it says: "The virtual machine does not support this operation" That means we can not do anything about this
in NetBeans, you need to complain to the developers of virtual machine.
I have no idea which changes you do in Java code. Please note that Sun's JVM does not support adding/removal of methods
and fields. I'm not aware of any attempts to improve this.
Comment 10 jsr 2008-07-22 23:29:19 UTC
So NetBeans failing to properly work after using this feature is an acceptable outcome? Isn't there anything that can be
reset when the project is redeployed so an IDE restart is not required?

No typical feature should require a restart of the IDE after use.
Comment 11 Martin Entlicher 2009-11-09 07:03:39 UTC
The "Unexpected JDWP Error: 32" is already "fixed" - we do not perform pop frame
operation when there are native frames on the stack.

When you get this error:
"The virtual machine does not support this operation: schema change not implemented"
that means that NetBeans *do work properly*, but you are using a JVM that does not support a schema change.
See: http://java.sun.com/j2se/1.4.2/docs/guide/jpda/jvmdi-spec.html#JVMDI_ERROR_SCHEMA_CHANGE_NOT_IMPLEMENTED
This is *not* NetBeans issue, this is *JVM* issue.
Comment 12 Quality Engineering 2010-04-29 09:32:00 UTC
Verified ... and Closing all issues resolved into NetBeans 6.7 and earlier.