Bug 443352 - parsing method name from weird proposal fails
Summary: parsing method name from weird proposal fails
Status: ASSIGNED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Recommenders (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Andreas Sewe CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2014-09-04 15:10 EDT by Marcel Bruch CLA
Modified: 2019-07-24 14:35 EDT (History)
1 user (show)

See Also:


Attachments
proposals for CommandServerSerializationStreamReader (9.79 KB, image/png)
2014-09-08 14:00 EDT, Andrey Bulanov CLA
no flags Details
Code Recommenders > Completions (31.47 KB, image/png)
2014-09-09 07:12 EDT, Andrey Bulanov CLA
no flags Details
Java > Editor > Content Assist > Advanced (23.55 KB, image/png)
2014-09-09 07:13 EDT, Andrey Bulanov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel Bruch CLA 2014-09-04 15:10:07 EDT
I could imagine that "CommandServerSerializationStreamReader(){} x1" causes trouble.


anonymousId=ea907b26-e66f-4363-a5dd-5253e538cb57
timestamp=Thu Sep 04 14:59:08 EDT 2014
eventId=9a6aa80e-f345-4987-9cae-a2eab05c9f8a
parentId=<null>
osgiWs=win32
osgiOs=Windows7
osgiOsVersion=6.1.0
osgiArch=x86_64
javaRuntimeVersion=1.8.0_20-b26
eclipseBuildId=4.4.0.I20140606-1215
pluginId=com.codetrails.connect.hippie.rcp
pluginVersion=1.2.11.v20140902-2015-b781
severity=ERROR
code=1
message=Could not parse method name from proposal: CommandServerSerializationStreamReader(Map x0, CommandServerSerializationStreamReader(){} x1) - com.google.gwt.rpc.server.CommandServerSerializationStreamReader
comment=<null>
trace= org.eclipse.recommenders.utils.Logs$LogTraceException: null
	at org.eclipse.recommenders.utils.Logs$LogTraceException.newTrace(Logs.java:377)
	at org.eclipse.recommenders.utils.Logs.log(Logs.java:130)
	at com.codetrails.connect.internal.hippie.rcp.completion.AbstractCompletionSessionProcessor.startSession(AbstractCompletionSessionProcessor.java:112)
	at org.eclipse.recommenders.completion.rcp.processable.IntelligentCompletionProposalComputer.fireStartSession(IntelligentCompletionProposalComputer.java:229)
	at org.eclipse.recommenders.completion.rcp.processable.IntelligentCompletionProposalComputer.computeCompletionProposals(IntelligentCompletionProposalComputer.java:131)
	at org.eclipse.jdt.internal.ui.text.java.CompletionProposalComputerDescriptor.computeCompletionProposals(CompletionProposalComputerDescriptor.java:333)
	at org.eclipse.jdt.internal.ui.text.java.CompletionProposalCategory.computeCompletionProposals(CompletionProposalCategory.java:337)
	at org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.collectProposals(ContentAssistProcessor.java:325)
	at org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.computeCompletionProposals(ContentAssistProcessor.java:282)
	at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:1861)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:573)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$16(CompletionProposalPopup.java:570)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup$14.run(CompletionProposalPopup.java:1610)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.incrementalComplete(CompletionProposalPopup.java:1604)
	at org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions(ContentAssistant.java:1686)
	at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:183)
	at org.eclipse.ui.texteditor.ContentAssistAction$1.run(ContentAssistAction.java:82)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.texteditor.ContentAssistAction.run(ContentAssistAction.java:80)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:519)
	at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:122)
	at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)
	at sun.reflect.GeneratedMethodAccessor97.invoke(null:-1)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:247)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:229)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
	at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:149)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:286)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:507)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:558)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:378)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.access$0(KeyBindingDispatcher.java:324)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:86)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1262)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1060)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1085)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1070)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1112)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1108)
	at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1529)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4722)
	at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:343)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4610)
	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:339)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5023)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(OS.java:-2)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2549)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:236)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
Comment 1 Andreas Sewe CLA 2014-09-08 12:56:26 EDT
I cannot reproduce this; every version of CommandServerSerializationStreamReader I looked at (2.0.4 to 2.6.1) has only two constructors: a public no-arg constructor and a private constructor taking a Map.

Is CommandServerSerializationStreamReader a nested or anonymous class in your code base? A few lines of surrounding context would be really helpful in this case.
Comment 2 Andrey Bulanov CLA 2014-09-08 13:22:56 EDT
I don't use in project CommandServerSerializationStreamReader, but it's class from gwt. 
For example you can find it:
https://gwt.googlesource.com/gwt.git/+/9453549842ae10f24d6299a52897d423bd8e0b7d/user/src/com/google/gwt/rpc/server/CommandServerSerializationStreamReader.java?autodive=0%2F%2F%2F
Comment 3 Andreas Sewe CLA 2014-09-08 13:32:59 EDT
(In reply to Andrey Bulanov from comment #2)
> I don't use in project CommandServerSerializationStreamReader, but it's
> class from gwt. 
> For example you can find it:
> https://gwt.googlesource.com/gwt.git/+/
> 9453549842ae10f24d6299a52897d423bd8e0b7d/user/src/com/google/gwt/rpc/server/
> CommandServerSerializationStreamReader.java?autodive=0%2F%2F%2F

Hi Andrey. Thanks for you help.

Yes, I found that class -- several versions, in fact. However, none of these has a constructor that reads anything like "CommandServerSerializationStreamReader(Map x0, CommandServerSerializationStreamReader(){} x1)"

Can you do me a favor and trigger code completion in the following situation (on a project that has GWT in its classpath):

  Object c = new CommandCommandServerSerializationStreamReader<Ctrl+Space>

Then please check whether the error shows up in the Error Log. Also, please tell me which proposals are made (there should be just one, I think: new CommandCommandServerSerializationStreamReader()). Thank you.
Comment 4 Andrey Bulanov CLA 2014-09-08 14:00:07 EDT
Created attachment 246845 [details]
proposals for CommandServerSerializationStreamReader
Comment 5 Andrey Bulanov CLA 2014-09-08 14:06:36 EDT
Error stable reproduced at my workspace for:
Object o = new CommandServerSerializationStreamReader<Ctrl+Space>

>Also, please tell me which proposals are made
see attache

>Yes, I found that class -- several versions, in fact. 
I use gwt-2.6.1
Comment 6 Andreas Sewe CLA 2014-09-09 04:44:23 EDT
Found out where the problematic constructor stems from: It is a synthetic constructor generated by javac to enforce visibility rules for inner classes:

  public class CommandServerSerializationStreamReader {

     private CommandServerSerializationStreamReader(Map<...> backRefs) { ... }

     class Visitor extends RpcCommandVisitor {

       public boolean visit(InvokeCustomFieldSerializerCommand x, Context ctx) {
         ...
         CommandServerSerializationStreamReader subReader = new CommandServerSerializationStreamReader(
            backRefs);
         ...
       }
     }
  }

To ensure that no class other than the inner class Visitor can access the *private* constructor of the outer class CommandServerSerializationStreamReader, javac creates a synthetic class CommandServerSerializationStreamReader$1 and a synthetic package-visible constructor taking both the Map and a dummy CommandServerSerializationStreamReader$1. This synthetic constructor then delegates to the private one.

However, that still doesn't explain why Content Assist proposes this constructor in the first place. Moreover, it even proposes the private constructor. And that's something that should never be visible outside CommandServerSerializationStreamReader.java. Strange.
Comment 7 Andreas Sewe CLA 2014-09-09 04:48:13 EDT
@Andrey: Can you please make a screenshot of both the "Code Recommenders > Completions" and "Java > Editor > Content Assist > Advanced" preference pages?

I'd really like to know what code completion engine contributes the two private/package-visible constructor proposals, but cannot reproduce the situation here on a simple test project with just gwt-servlet-2.6.1.jar on the classpath:

  public class Test {
    public void method() {
      Object o = new CommandServerSerializationStreamReader<Ctrl+Space>
    }
  }

That just completes to the public, no-args constructor for me.
Comment 8 Andrey Bulanov CLA 2014-09-09 07:12:50 EDT
Created attachment 246875 [details]
Code Recommenders > Completions
Comment 9 Andrey Bulanov CLA 2014-09-09 07:13:21 EDT
Created attachment 246876 [details]
Java > Editor > Content Assist > Advanced
Comment 10 Andrey Bulanov CLA 2014-09-09 07:14:25 EDT
(In reply to Andreas Sewe from comment #7)
> Can you please make a screenshot of both the "Code Recommenders >
> Completions" and "Java > Editor > Content Assist > Advanced" preference
> pages?

done
Comment 11 Andreas Sewe CLA 2014-09-09 07:16:24 EDT
(In reply to Andrey Bulanov from comment #10)
> (In reply to Andreas Sewe from comment #7)
>> Can you please make a screenshot of both the "Code Recommenders >
>> Completions" and "Java > Editor > Content Assist > Advanced" preference
>> pages?
> 
> done

Thank you.
Comment 12 Andrey Bulanov CLA 2014-09-09 07:49:12 EDT
I created a new workspace and project and can't reproduced too.
But reproduced on my worked workspace.
I also import settings from worked workspace.
Comment 13 Andreas Sewe CLA 2014-09-09 07:54:05 EDT
(In reply to Andrey Bulanov from comment #12)
> I created a new workspace and project and can't reproduced too.
> But reproduced on my worked workspace.
> I also import settings from worked workspace.

Interesting. Did you notice (besides the message in the Error Log) anything odd about the way code completion behaves?

In particular, does (in the same source file where you reproduced the error)

  CommandServerSerializationStreamReader o = new CommandServerSerializationStreamReader();
  o.<Ctrl+Space>

propose private methods like readNextCommand or are the problematic proposals limited to constructors that shouldn't be proposed due to visibility constraints?
Comment 14 Andrey Bulanov CLA 2014-09-09 09:12:18 EDT
(In reply to Andreas Sewe from comment #13)
> Interesting. Did you notice (besides the message in the Error Log) anything
> odd about the way code completion behaves?
No

> In particular, does (in the same source file where you reproduced the error)
>   CommandServerSerializationStreamReader o = new
> CommandServerSerializationStreamReader();
>   o.<Ctrl+Space>
> propose private methods like readNextCommand or are the problematic
> proposals limited to constructors that shouldn't be proposed due to
> visibility constraints?
Yes I see readNextCommand and it's ok because in my settings: Java > Content Assist > Hide proposal not visible in the invocation context (unchecked)

Also I cleaned and rebuilt projects and can't reproduce it any more. Or may be after chack/uncheck - Hide proposal not visible in the invocation context
Comment 15 Andreas Sewe CLA 2014-09-11 04:00:18 EDT
(In reply to Andrey Bulanov from comment #14)
> (In reply to Andreas Sewe from comment #13)
> > Interesting. Did you notice (besides the message in the Error Log) anything
> > odd about the way code completion behaves?
> No
> 
> > In particular, does (in the same source file where you reproduced the error)
> >   CommandServerSerializationStreamReader o = new
> > CommandServerSerializationStreamReader();
> >   o.<Ctrl+Space>
> > propose private methods like readNextCommand or are the problematic
> > proposals limited to constructors that shouldn't be proposed due to
> > visibility constraints?
> Yes I see readNextCommand and it's ok because in my settings: Java > Content
> Assist > Hide proposal not visible in the invocation context (unchecked)
> 
> Also I cleaned and rebuilt projects and can't reproduce it any more. Or may
> be after chack/uncheck - Hide proposal not visible in the invocation context

OK, this seems to be an issue with JDT proposing synthetic constructors (which it IMHO never should, even if you have unchecked "Hide proposals"). A have opened Bug 443784 to hear the JDT team's opinion on this.