void () { DefaultLogger.disableStderrDumping(getTestRootDisposable()); EditorColorsScheme defaultScheme = EditorColorsManager.getInstance().getScheme(EditorColorsScheme.DEFAULT_SCHEME_NAME); EditorColorsScheme editorColorsScheme = (EditorColorsScheme)defaultScheme.clone(); editorColorsScheme.setName("test"); TextAttributesKey keyD = TextAttributesKey.createTextAttributesKey("D"); TextAttributesKey keyC = TextAttributesKey.createTextAttributesKey("C", keyD); TextAttributesKey keyB = TextAttributesKey.createTextAttributesKey("B", keyC); TextAttributesKey keyA = TextAttributesKey.createTextAttributesKey("A", keyB); try { keyD = TextAttributesKey.createTextAttributesKey("D", keyB); fail("Must fail"); } catch (IllegalArgumentException e) { String s = e.getMessage(); assertTrue(s, s.matches(".*B.*->C.*->.*D.*")); try { editorColorsScheme.getAttributes(keyA); } catch (StackOverflowError ignored) { fail("Stack overflow detected!"); } } finally { TextAttributesKey.removeTextAttributesKey(keyA.getExternalName()); TextAttributesKey.removeTextAttributesKey(keyB.getExternalName()); TextAttributesKey.removeTextAttributesKey(keyC.getExternalName()); TextAttributesKey.removeTextAttributesKey(keyD.getExternalName()); } }