Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE en el editor al tratar de colorear #1961

Closed
fdodino opened this issue Nov 7, 2020 · 4 comments
Closed

NPE en el editor al tratar de colorear #1961

fdodino opened this issue Nov 7, 2020 · 4 comments
Assignees

Comments

@fdodino
Copy link
Collaborator

fdodino commented Nov 7, 2020

El error que tira es

java.lang.NullPointerException
	at java.lang.String.indexOf(String.java:1718)
	at org.uqbar.project.wollok.ui.highlight.WollokHighlightingCalculator.addHighlight(WollokHighlightingCalculator.java:103)
	at org.uqbar.project.wollok.ui.highlight.WollokHighlightingCalculator.highlightComponent(WollokHighlightingCalculator.java:80)
	at org.uqbar.project.wollok.ui.highlight.WollokHighlightingCalculator._highlight(WollokHighlightingCalculator.java:65)
	at org.uqbar.project.wollok.ui.highlight.WollokHighlightingCalculator.highlight(WollokHighlightingCalculator.java:178)
	at org.uqbar.project.wollok.ui.highlight.WollokHighlightingCalculator.highlightElement(WollokHighlightingCalculator.java:55)
	at org.eclipse.xtext.ide.editor.syntaxcoloring.DefaultSemanticHighlightingCalculator.highlightElementRecursively(DefaultSemanticHighlightingCalculator.java:87)
	at org.eclipse.xtext.ide.editor.syntaxcoloring.DefaultSemanticHighlightingCalculator.searchAndHighlightElements(DefaultSemanticHighlightingCalculator.java:79)
	at org.eclipse.xtext.ide.editor.syntaxcoloring.DefaultSemanticHighlightingCalculator.doProvideHighlightingFor(DefaultSemanticHighlightingCalculator.java:69)
	at org.eclipse.xtext.ide.editor.syntaxcoloring.DefaultSemanticHighlightingCalculator.provideHighlightingFor(DefaultSemanticHighlightingCalculator.java:45)
	at org.eclipse.xtext.ide.editor.syntaxcoloring.MergingHighlightedPositionAcceptor.provideHighlightingFor(MergingHighlightedPositionAcceptor.java:63)
	at org.eclipse.xtext.ui.editor.syntaxcoloring.HighlightingReconciler.reconcilePositions(HighlightingReconciler.java:157)
	at org.eclipse.xtext.ui.editor.syntaxcoloring.HighlightingReconciler.modelChanged(HighlightingReconciler.java:417)
	at org.eclipse.xtext.ui.editor.syntaxcoloring.HighlightingReconciler$2$1.exec(HighlightingReconciler.java:356)
	at org.eclipse.xtext.ui.editor.syntaxcoloring.HighlightingReconciler$2$1.exec(HighlightingReconciler.java:1)
	at org.eclipse.xtext.util.concurrent.CancelableUnitOfWork.exec(CancelableUnitOfWork.java:26)
	at org.eclipse.xtext.util.concurrent.WrappingCancelableUnitOfWork.exec(WrappingCancelableUnitOfWork.java:57)
	at org.eclipse.xtext.util.concurrent.CancelableUnitOfWork.exec(CancelableUnitOfWork.java:26)
	at org.eclipse.xtext.resource.OutdatedStateManager.exec(OutdatedStateManager.java:91)
	at org.eclipse.xtext.ui.editor.model.XtextDocument$XtextDocumentLocker.internalReadOnly(XtextDocument.java:524)
	at org.eclipse.xtext.ui.editor.model.XtextDocument$XtextDocumentLocker.readOnly(XtextDocument.java:496)
	at org.eclipse.xtext.ui.editor.model.XtextDocument.readOnly(XtextDocument.java:135)
	at org.eclipse.xtext.util.concurrent.IReadAccess.tryReadOnly(IReadAccess.java:49)
	at org.eclipse.xtext.util.concurrent.IReadAccess.tryReadOnly(IReadAccess.java:70)
	at org.eclipse.xtext.ui.editor.syntaxcoloring.HighlightingReconciler$2.run(HighlightingReconciler.java:351)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

y me pasó una vez con este archivo (no lo pude replicar después)

import contratistas.*
import latas.*
import clientes.*

class Casa {
	var property ambientes = []
	var property pisos 
	
	method superficie() = ambientes.sum( {ambiente => ambiente.superficie()} )
	method cantidadDeAmbientes() = ambientes.size()
	method esComplicada() = pisos > 2
}

object casaDeAldo inherits Casa(
	ambientes = [habitacion, cocina],
	pisos = 2
){}

object casaDeDamian inherits Casa(
	ambientes = [habitacion, habitacion, habitacion, habitacion],
	pisos = 4
){}

object casaDeMilena inherits Casa(
	ambientes = [habitacion, cocina],
	pisos = 2
){}

object cocina {
	const altura = 3.5
	const largo = 2
	const ancho = 1
	
	method superficie() { return ((ancho + largo) * 2 * altura) }
}

object habitacion {
	method superficie() = 20
}


@fdodino
Copy link
Collaborator Author

fdodino commented Nov 7, 2020

Otro tema del coloreado:

// este object, si quieren que aparezca aleatoriamente, tendrán que agregarlo y removerlo
// 
object nafta inherits Extra (position = game.at(1.randomUpTo(4), 10)){
	method image() = "nafta.jpg"
	
	method litrosQueOtorga() = 20

deja un coloreado raro por culpa del comentario "este object"...

@PalumboN
Copy link
Contributor

PalumboN commented Nov 8, 2020

Puede estar related #1955 ?

@fdodino
Copy link
Collaborator Author

fdodino commented Nov 8, 2020

En realidad es el objeto que maneja los errores del parser, resulta que no puede obtener el nombre del método y se rompe mal. Ahora lo comento en ese issue.

@fdodino
Copy link
Collaborator Author

fdodino commented Nov 8, 2020

Lo curioso es que los dos errores iniciales que detecté son parte de lo mismo.
Mañana subo PR que arregla estas dos situaciones.

@fdodino fdodino self-assigned this Nov 8, 2020
@fdodino fdodino added this to the Wollok 3.0.0 J milestone Nov 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants