Aller au contenu

Utilisateur:DavidL/Test36

Un livre de Wikilivres.

Bug java8 / Eclipse

En utilisant StringBuilder, expression conditionnelle et concaténation :

String[] errors = new String[2];
StringBuilder sb = new StringBuilder(
	(errors.length>0 ? "Some error":"No error")+
	" occurred while generating documentation");

une erreur se produit à l'exécution :

Exception in thread "main" java.lang.VerifyError: Inconsistent stackmap frames at branch target xxx


En utilisant StringBuffer au lieu de StringBuilder, plus aucune erreur.

String[] errors = new String[2];
StringBuffer sb = new StringBuffer(
	(errors.length>0 ? "Some error":"No error")+
	" occurred while generating documentation");