“Cannot find getter/setter for field” caused by language specific characters
I had been getting "cannot find getter/setter" errors from libraries like Room and Firebase even though the camel-case syntax seemed right. This error applied only to fields which had names starting with "i".
Uppercase of "i" is "İ" in my language and it turns out the compiler is looking for "İ" instead of "I". So for example if the field name is "id", Room looks for a method with name of "getİd".
How do I disable this feature?
Edit: yes i can just replace all 'I's with 'İ' or rename fields to something else and that would solve it. But thats just weird and i would like to stay in standart way.
add a comment |
I had been getting "cannot find getter/setter" errors from libraries like Room and Firebase even though the camel-case syntax seemed right. This error applied only to fields which had names starting with "i".
Uppercase of "i" is "İ" in my language and it turns out the compiler is looking for "İ" instead of "I". So for example if the field name is "id", Room looks for a method with name of "getİd".
How do I disable this feature?
Edit: yes i can just replace all 'I's with 'İ' or rename fields to something else and that would solve it. But thats just weird and i would like to stay in standart way.
Interesting case. What language? Turkish?
– naXa
Nov 25 '18 at 0:56
the compiler is looking for "İ" instead of "I"any proofs of this statement? can you share more details - error message, stack trace, Room and Firebase versions?
– naXa
Nov 25 '18 at 0:59
Yes turkish language
– user10314481
Nov 25 '18 at 1:00
i dont have a hard proof for that, figured it out by manually changing I to İ and error was gone
– user10314481
Nov 25 '18 at 1:02
add a comment |
I had been getting "cannot find getter/setter" errors from libraries like Room and Firebase even though the camel-case syntax seemed right. This error applied only to fields which had names starting with "i".
Uppercase of "i" is "İ" in my language and it turns out the compiler is looking for "İ" instead of "I". So for example if the field name is "id", Room looks for a method with name of "getİd".
How do I disable this feature?
Edit: yes i can just replace all 'I's with 'İ' or rename fields to something else and that would solve it. But thats just weird and i would like to stay in standart way.
I had been getting "cannot find getter/setter" errors from libraries like Room and Firebase even though the camel-case syntax seemed right. This error applied only to fields which had names starting with "i".
Uppercase of "i" is "İ" in my language and it turns out the compiler is looking for "İ" instead of "I". So for example if the field name is "id", Room looks for a method with name of "getİd".
How do I disable this feature?
Edit: yes i can just replace all 'I's with 'İ' or rename fields to something else and that would solve it. But thats just weird and i would like to stay in standart way.
edited Nov 25 '18 at 0:52
user10314481
asked Nov 24 '18 at 22:23
user10314481user10314481
275
275
Interesting case. What language? Turkish?
– naXa
Nov 25 '18 at 0:56
the compiler is looking for "İ" instead of "I"any proofs of this statement? can you share more details - error message, stack trace, Room and Firebase versions?
– naXa
Nov 25 '18 at 0:59
Yes turkish language
– user10314481
Nov 25 '18 at 1:00
i dont have a hard proof for that, figured it out by manually changing I to İ and error was gone
– user10314481
Nov 25 '18 at 1:02
add a comment |
Interesting case. What language? Turkish?
– naXa
Nov 25 '18 at 0:56
the compiler is looking for "İ" instead of "I"any proofs of this statement? can you share more details - error message, stack trace, Room and Firebase versions?
– naXa
Nov 25 '18 at 0:59
Yes turkish language
– user10314481
Nov 25 '18 at 1:00
i dont have a hard proof for that, figured it out by manually changing I to İ and error was gone
– user10314481
Nov 25 '18 at 1:02
Interesting case. What language? Turkish?
– naXa
Nov 25 '18 at 0:56
Interesting case. What language? Turkish?
– naXa
Nov 25 '18 at 0:56
the compiler is looking for "İ" instead of "I" any proofs of this statement? can you share more details - error message, stack trace, Room and Firebase versions?– naXa
Nov 25 '18 at 0:59
the compiler is looking for "İ" instead of "I" any proofs of this statement? can you share more details - error message, stack trace, Room and Firebase versions?– naXa
Nov 25 '18 at 0:59
Yes turkish language
– user10314481
Nov 25 '18 at 1:00
Yes turkish language
– user10314481
Nov 25 '18 at 1:00
i dont have a hard proof for that, figured it out by manually changing I to İ and error was gone
– user10314481
Nov 25 '18 at 1:02
i dont have a hard proof for that, figured it out by manually changing I to İ and error was gone
– user10314481
Nov 25 '18 at 1:02
add a comment |
2 Answers
2
active
oldest
votes
You could change the template.
Here is class named Test:
public class Test {
int id;
}
press Alt + Insert and click Getter, it will pop up a dialog

click ... button, you will see the template:

now replace with
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))
with
#set($name = $helper.getPropertyName($field, $project))
now the getter name should be getid.
add a comment |
It seems like a bug in IntelliJ IDEA code generator or libraries that you use. While the correct solution is to contact IntelliJ IDEA support and submit bug report, we may have to wait a long time for the fix. Meantime, you can use the below workaround.
Do as navylover said: open Getter and Setter template dialog, but do not modify the 'IntelliJ Default' template. Duplicate the template and replace
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))
with
#set($name = $StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project)))
#if($name.charAt(0) == 'i')
#set($name = 'İ' + $name.substring(1))
#else
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($name))
#end
It's a simple workaround for leading 'i' capitalization. Apply the same fix for Setter template.
A full template should look like:

add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53462874%2fcannot-find-getter-setter-for-field-caused-by-language-specific-characters%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You could change the template.
Here is class named Test:
public class Test {
int id;
}
press Alt + Insert and click Getter, it will pop up a dialog

click ... button, you will see the template:

now replace with
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))
with
#set($name = $helper.getPropertyName($field, $project))
now the getter name should be getid.
add a comment |
You could change the template.
Here is class named Test:
public class Test {
int id;
}
press Alt + Insert and click Getter, it will pop up a dialog

click ... button, you will see the template:

now replace with
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))
with
#set($name = $helper.getPropertyName($field, $project))
now the getter name should be getid.
add a comment |
You could change the template.
Here is class named Test:
public class Test {
int id;
}
press Alt + Insert and click Getter, it will pop up a dialog

click ... button, you will see the template:

now replace with
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))
with
#set($name = $helper.getPropertyName($field, $project))
now the getter name should be getid.
You could change the template.
Here is class named Test:
public class Test {
int id;
}
press Alt + Insert and click Getter, it will pop up a dialog

click ... button, you will see the template:

now replace with
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))
with
#set($name = $helper.getPropertyName($field, $project))
now the getter name should be getid.
answered Nov 24 '18 at 22:46
navylovernavylover
3,42021118
3,42021118
add a comment |
add a comment |
It seems like a bug in IntelliJ IDEA code generator or libraries that you use. While the correct solution is to contact IntelliJ IDEA support and submit bug report, we may have to wait a long time for the fix. Meantime, you can use the below workaround.
Do as navylover said: open Getter and Setter template dialog, but do not modify the 'IntelliJ Default' template. Duplicate the template and replace
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))
with
#set($name = $StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project)))
#if($name.charAt(0) == 'i')
#set($name = 'İ' + $name.substring(1))
#else
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($name))
#end
It's a simple workaround for leading 'i' capitalization. Apply the same fix for Setter template.
A full template should look like:

add a comment |
It seems like a bug in IntelliJ IDEA code generator or libraries that you use. While the correct solution is to contact IntelliJ IDEA support and submit bug report, we may have to wait a long time for the fix. Meantime, you can use the below workaround.
Do as navylover said: open Getter and Setter template dialog, but do not modify the 'IntelliJ Default' template. Duplicate the template and replace
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))
with
#set($name = $StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project)))
#if($name.charAt(0) == 'i')
#set($name = 'İ' + $name.substring(1))
#else
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($name))
#end
It's a simple workaround for leading 'i' capitalization. Apply the same fix for Setter template.
A full template should look like:

add a comment |
It seems like a bug in IntelliJ IDEA code generator or libraries that you use. While the correct solution is to contact IntelliJ IDEA support and submit bug report, we may have to wait a long time for the fix. Meantime, you can use the below workaround.
Do as navylover said: open Getter and Setter template dialog, but do not modify the 'IntelliJ Default' template. Duplicate the template and replace
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))
with
#set($name = $StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project)))
#if($name.charAt(0) == 'i')
#set($name = 'İ' + $name.substring(1))
#else
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($name))
#end
It's a simple workaround for leading 'i' capitalization. Apply the same fix for Setter template.
A full template should look like:

It seems like a bug in IntelliJ IDEA code generator or libraries that you use. While the correct solution is to contact IntelliJ IDEA support and submit bug report, we may have to wait a long time for the fix. Meantime, you can use the below workaround.
Do as navylover said: open Getter and Setter template dialog, but do not modify the 'IntelliJ Default' template. Duplicate the template and replace
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))
with
#set($name = $StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project)))
#if($name.charAt(0) == 'i')
#set($name = 'İ' + $name.substring(1))
#else
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($name))
#end
It's a simple workaround for leading 'i' capitalization. Apply the same fix for Setter template.
A full template should look like:

edited Nov 25 '18 at 1:57
answered Nov 25 '18 at 1:35
naXanaXa
13.4k888136
13.4k888136
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53462874%2fcannot-find-getter-setter-for-field-caused-by-language-specific-characters%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Interesting case. What language? Turkish?
– naXa
Nov 25 '18 at 0:56
the compiler is looking for "İ" instead of "I"any proofs of this statement? can you share more details - error message, stack trace, Room and Firebase versions?– naXa
Nov 25 '18 at 0:59
Yes turkish language
– user10314481
Nov 25 '18 at 1:00
i dont have a hard proof for that, figured it out by manually changing I to İ and error was gone
– user10314481
Nov 25 '18 at 1:02