Bug 55765 - JavaMethod should not expose JavaString in its API
Summary: JavaMethod should not expose JavaString in its API
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Steve Block
URL:
Keywords:
Depends on: 55774 55966 55967
Blocks: 55383
  Show dependency treegraph
 
Reported: 2011-03-04 04:23 PST by Steve Block
Modified: 2011-04-06 10:39 PDT (History)
10 users (show)

See Also:


Attachments
Patch 1 (36.79 KB, patch)
2011-03-08 05:52 PST, Steve Block
no flags Details | Formatted Diff | Diff
Patch (21.25 KB, patch)
2011-03-30 04:33 PDT, Steve Block
no flags Details | Formatted Diff | Diff
Patch 3 (33.03 KB, patch)
2011-03-30 04:55 PDT, Steve Block
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Block 2011-03-04 04:23:02 PST
JavaMethod, which is used by the Java bridge to represent a method of a Java class, uses JavaString for the return value of its name() method. JavaString is a utility class intended to convert from the JNI string type jstring to WTF::String and char*. There's no need for JavaMethod to expose this utility type in its API. Instead it should just expose WTF::String, using JavaString internally where appropriate.

JavaString exposes JNI types in its API and JavaInstance exposes JavaMethod in its API, so removing JavaString from JavaMethod's API will allow us to remove the dependency of JavaInstance on JNI types. See Bug 55383.
Comment 1 Steve Block 2011-03-08 05:52:53 PST
Created attachment 85044 [details]
Patch 1
Comment 2 Andrei Popescu 2011-03-08 06:58:30 PST
Looks good but:

>  virtual String name() const = 0;
...
>  virtual const char* signature() const= 0;

Why is one returning a String and the other a char*?
Comment 3 Steve Block 2011-03-08 07:24:13 PST
Comment on attachment 85044 [details]
Patch 1

View in context: https://bugs.webkit.org/attachment.cgi?id=85044&action=review

> Source/WebCore/bridge/jni/JavaMethod.h:48
> +    virtual const char* signature() const= 0;

name() used to return const JavaString& but this had to be changed to avoid JNI types in the API. String seems to be the obvious choice instead. I left signature() returning const char* because I wanted to make as few changes as possible. Note that returnType() also returns const char*.

If you think all three should use String, I'm happy to make the change but would rather do so in a separate patch to keep this one as simple as possible.
Comment 4 Andrei Popescu 2011-03-08 08:22:41 PST
LGTM

(In reply to comment #3)
> (From update of attachment 85044 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=85044&action=review
> 
> > Source/WebCore/bridge/jni/JavaMethod.h:48
> > +    virtual const char* signature() const= 0;
> 
> name() used to return const JavaString& but this had to be changed to avoid JNI types in the API. String seems to be the obvious choice instead. I left signature() returning const char* because I wanted to make as few changes as possible. Note that returnType() also returns const char*.
> 
> If you think all three should use String, I'm happy to make the change but would rather do so in a separate patch to keep this one as simple as possible.

Fine with doing in a subsequent CL, just wanted to understand why the difference.
Comment 5 Jeremy Orlow 2011-03-08 21:06:29 PST
Comment on attachment 85044 [details]
Patch 1

View in context: https://bugs.webkit.org/attachment.cgi?id=85044&action=review

rubber stamp = me assuming andrei LGTMs it

>>> Source/WebCore/bridge/jni/JavaMethod.h:48
>>> +    virtual const char* signature() const= 0;
>> 
>> name() used to return const JavaString& but this had to be changed to avoid JNI types in the API. String seems to be the obvious choice instead. I left signature() returning const char* because I wanted to make as few changes as possible. Note that returnType() also returns const char*.
>> 
>> If you think all three should use String, I'm happy to make the change but would rather do so in a separate patch to keep this one as simple as possible.
> 
> Fine with doing in a subsequent CL, just wanted to understand why the difference.

Space before =

> Source/WebCore/bridge/jni/JavaMethod.h:49
> +    virtual JNIType JNIReturnType() const= 0;

Space before =
Comment 6 Steve Block 2011-03-09 04:29:56 PST
Comment on attachment 85044 [details]
Patch 1

Will fix style and land manually. Also needs rebasing due to Bug 55966 and Bug 55967.
Comment 7 Steve Block 2011-03-30 04:33:31 PDT
Created attachment 87501 [details]
Patch
Comment 8 Collabora GTK+ EWS bot 2011-03-30 04:44:14 PDT
Attachment 87501 [details] did not build on gtk:
Build output: http://queues.webkit.org/results/8297396
Comment 9 WebKit Review Bot 2011-03-30 04:47:47 PDT
Attachment 87501 [details] did not build on chromium:
Build output: http://queues.webkit.org/results/8297397
Comment 10 Steve Block 2011-03-30 04:55:39 PDT
Created attachment 87504 [details]
Patch 3
Comment 11 Steve Block 2011-03-30 05:20:06 PDT
> Fine with doing in a subsequent CL, just wanted to understand why the difference.
Filed Bug 57443 to track this.
Comment 12 Steve Block 2011-03-30 05:28:42 PDT
Committed r82423: <http://trac.webkit.org/changeset/82423>
Comment 13 WebKit Review Bot 2011-03-30 14:40:57 PDT
http://trac.webkit.org/changeset/82423 might have broken GTK Linux 32-bit Debug
Comment 14 Eric Seidel (no email) 2011-04-06 10:39:28 PDT
Comment on attachment 87504 [details]
Patch 3

Cleared review? from attachment 87504 [details] so that this bug does not appear in http://webkit.org/pending-review.  If you would like this patch reviewed, please attach it to a new bug (or re-open this bug before marking it for review again).