Bug 568970 - Switch in a property listener
Summary: Switch in a property listener
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.17   Edit
Hardware: PC Windows 10
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: greatbug, noteworthy
Depends on:
Blocks:
 
Reported: 2020-11-19 18:04 EST by Manuel Podeur CLA
Modified: 2023-01-10 04:00 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Manuel Podeur CLA 2020-11-19 18:04:01 EST
-- Configuration Details --
Product: Eclipse IDE 4.17.0.20200910-1200 (org.eclipse.epp.package.jee.product)Installed Features:
 org.eclipse.jdt 3.18.500.v20200902-1800
Versioning Plugin:
 org.eclipse.platform 4.17.0.v20200902-1800
 
When I add a listener on a property and I put a switch block in it and the save, I get this error when I hover the red x that appears in the absolute top of my class next to my package name. Internal compiler error: java.lang.StringIndexOutOfBoundsException: offset 3912, count -29, length 4918 at java.base/java.lang.String.checkBoundsOffCount(String.java:3741)
 
 Also, when I type in the switch block, I press CTRL+SPACEBAR and there is no autocomplete suggestions that are listed when there should clearly be one.
 
 @Override
	public void initialize(URL location, ResourceBundle resources) {
		createComboBox();
		addEventFilters();
		aConvertirLabel.textProperty().bind(calculatriceController.getReponseLabel().textProperty());
		javafx.util.StringConverter<Number> converter = new NumberStringConverter();
		Bindings.bindBidirectional(aConvertirLabel.textProperty(), aConvertir, converter);
		aConvertir = new SimpleDoubleProperty();
		converti = new SimpleDoubleProperty();
		comboBox.selectionModelProperty();
		
		Bindings.bindBidirectional(aConvertirLabel.textProperty(), aConvertir, converter);
		convertiLabel.textProperty().bind(converti.asString());
		aConvertir.addListener((a)->{
			
			switch(comboBox.getSelectionModel().getSelectedIndex()) {
			case 0:
				aConvertir;
				break;
			default:
				break;
			}
		});
	}
The above code is how the bug happened.
	
I tried opening the class in Intelliji and everything worked just fine. If i close eclipse and I try to reopen it, I can't open this class file and the is a log for the bug but I don't know how to add it to the file becasue if I add it, it says that it's too long.
Comment 1 Andrey Loskutov CLA 2020-11-20 11:48:27 EST
Please check if 4.18 M§ works for you & please attach full error log.
I guess another duplicate of bug 567319.
Comment 2 Andrey Loskutov CLA 2020-11-20 11:49:00 EST
(In reply to Andrey Loskutov from comment #1)
> Please check if 4.18 *M3* works for you
Comment 3 Eclipse Genie CLA 2023-01-10 04:00:44 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.