bug in extract method object

When returning a boolean from a generated method object, IntelliJ 8 creates a method is<Variablename> inside the method object class, but the extract method refactoring incorrectly tries to call this using get<Variablename>.

For example it generates the following:

                                MapBindVariables mapBindVariables = new MapBindVariables(q, bvList, values, c).invoke();
                                bv = mapBindVariables.getBv();
                                hasAnyNullParam = mapBindVariables.getHasAnyNullParam();
                                hasAllNullParam = mapBindVariables.getHasAllNullParam();

for the generated inner class:
    private class MapBindVariables {
        private final QueryConfig q;
        private final ArrayList bvList;
        private final Object[] values;
        private final int c;
        private boolean hasAllNullParam;
        private boolean hasAnyNullParam;
        private BindVar[] bv;
        public MapBindVariables(final QueryConfig q, final ArrayList bvList, final Object[] values, final int c) {
            this.q = q;
            this.bvList = bvList;
            this.values = values;
            this.c = c;
        }
        public boolean isHasAllNullParam() {
            return hasAllNullParam;
        }
        public boolean isHasAnyNullParam() {
            return hasAnyNullParam;
        }
        public BindVar[] getBv() {
            return bv;
        }
        public MapBindVariables invoke() {
            // code removed for clarity
            return this;
        }
    }

Created Jira issue IDEA-20891 for this http://www.jetbrains.net/jira/browse/IDEA-20891

1 comment
Comment actions Permalink

Hello Jeroen,

Fixed. Thank you
-


Anna Kozlova
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

When returning a boolean from a generated method object, IntelliJ 8
creates a method is<Variablename> inside the method object class, but
the extract method refactoring incorrectly tries to call this using
get<Variablename>.

For example it generates the following:

MapBindVariables mapBindVariables =
new MapBindVariables(q, bvList, values, c).invoke();

bv = mapBindVariables.getBv();

hasAnyNullParam = mapBindVariables.getHasAnyNullParam();

hasAllNullParam = mapBindVariables.getHasAllNullParam();
for the generated inner class:
private class MapBindVariables {
private final
QueryConfig q;
private final ArrayList bvList;

private final Object[] values;
private final int c;

private boolean hasAllNullParam;
private boolean
hasAnyNullParam;
private BindVa
r[] bv;
public MapBindVariables(final QueryConfig q, final ArrayList
bvList, final Object[] values, final int c) {
this.q =
q;
this.bvList = bvList;
this.values =
values;
this.c = c;
}
public boolean isHasAllNullParam() {
return
hasAllNullParam;
}
public boolean isHasAnyNullParam() {
return
hasAnyNullParam;
}
public BindVar[] getBv() {
return bv;

}
public MapBindVariables invoke() {
// code removed for clarity
return this;

}
}
Created Jira issue IDEA-20891 for this


---
Original message URL:
http://www.jetbrains.net/devnet/message/5227725#5227725



0

Please sign in to leave a comment.