platofrm: set fsnotifier glibc compatibility only for i386/amd64
[idea/community.git] / java / java-tests / testSrc / com / intellij / psi / impl / smartPointers / SmartPsiElementPointersTest.java
1 /*
2  * Copyright 2000-2015 JetBrains s.r.o.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.intellij.psi.impl.smartPointers;
17
18 import com.intellij.JavaTestUtil;
19 import com.intellij.codeInsight.CodeInsightTestCase;
20 import com.intellij.ide.highlighter.HtmlFileType;
21 import com.intellij.ide.highlighter.JavaFileType;
22 import com.intellij.openapi.command.WriteCommandAction;
23 import com.intellij.openapi.editor.Document;
24 import com.intellij.openapi.editor.EditorFactory;
25 import com.intellij.openapi.editor.event.DocumentEvent;
26 import com.intellij.openapi.editor.event.DocumentListener;
27 import com.intellij.openapi.editor.event.EditorEventMulticaster;
28 import com.intellij.openapi.fileEditor.FileDocumentManager;
29 import com.intellij.openapi.fileTypes.StdFileTypes;
30 import com.intellij.openapi.util.TextRange;
31 import com.intellij.openapi.vfs.VfsUtil;
32 import com.intellij.openapi.vfs.VirtualFile;
33 import com.intellij.psi.*;
34 import com.intellij.psi.impl.source.PsiFileImpl;
35 import com.intellij.psi.impl.source.tree.FileElement;
36 import com.intellij.psi.search.GlobalSearchScope;
37 import com.intellij.psi.stubs.StubTree;
38 import com.intellij.psi.util.PsiTreeUtil;
39 import com.intellij.psi.util.PsiUtil;
40 import com.intellij.psi.util.PsiUtilBase;
41 import com.intellij.psi.xml.XmlTag;
42 import com.intellij.testFramework.IdeaTestUtil;
43 import com.intellij.testFramework.PlatformTestCase;
44 import com.intellij.testFramework.PlatformTestUtil;
45 import com.intellij.testFramework.PsiTestUtil;
46 import com.intellij.util.FileContentUtil;
47 import gnu.trove.THashSet;
48 import org.junit.Assert;
49
50 import java.io.IOException;
51 import java.lang.ref.SoftReference;
52 import java.util.Collections;
53 import java.util.Set;
54
55 @PlatformTestCase.WrapInCommand
56 public class SmartPsiElementPointersTest extends CodeInsightTestCase {
57   private VirtualFile myRoot;
58
59   @Override
60   protected void setUp() throws Exception {
61     super.setUp();
62
63     String root = JavaTestUtil.getJavaTestDataPath() + "/codeEditor/smartPsiElementPointers";
64     PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
65     myRoot = PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
66   }
67
68   public void testChangeInDocument() {
69     PsiClass aClass = myJavaFacade.findClass("AClass", GlobalSearchScope.allScope(getProject()));
70     assertNotNull(aClass);
71
72     SmartPsiElementPointer pointer = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(aClass);
73     Document document = PsiDocumentManager.getInstance(myProject).getDocument(aClass.getContainingFile());
74
75     int offset = aClass.getTextOffset();
76     document.insertString(offset, "/**/");
77     PsiDocumentManager.getInstance(myProject).commitAllDocuments();
78
79     PsiElement element = pointer.getElement();
80     assertNotNull(element);
81     assertTrue(element instanceof PsiClass);
82     assertTrue(element.isValid());
83   }
84
85   // This test is unfair. If pointer would be asked for getElement() between commits it'll never restore again anyway.
86   //
87   public void testChangeInDocumentTwice() {
88     PsiClass aClass = myJavaFacade.findClass("AClass",GlobalSearchScope.allScope(getProject()));
89     assertNotNull(aClass);
90
91     SmartPsiElementPointer pointer = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(aClass);
92     Document document = PsiDocumentManager.getInstance(myProject).getDocument(aClass.getContainingFile());
93
94     int offset = aClass.getTextOffset();
95     document.insertString(offset, "/*");
96     PsiDocumentManager.getInstance(myProject).commitAllDocuments();
97     document.insertString(offset + 2, "*/");
98     PsiDocumentManager.getInstance(myProject).commitAllDocuments();
99
100     PsiElement element = pointer.getElement();
101     assertNotNull(element);
102     assertTrue(element instanceof PsiClass);
103     assertTrue(element.isValid());
104   }
105
106   public void testGetElementWhenDocumentModified() {
107     PsiClass aClass = myJavaFacade.findClass("AClass",GlobalSearchScope.allScope(getProject()));
108     assertNotNull(aClass);
109
110     SmartPsiElementPointer pointer = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(aClass);
111     Document document = PsiDocumentManager.getInstance(myProject).getDocument(aClass.getContainingFile());
112
113     int offset = aClass.getTextOffset();
114     document.insertString(offset, "/**/");
115     PsiDocumentManager.getInstance(myProject).commitAllDocuments();
116
117     document.insertString(offset, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
118
119     PsiElement element = pointer.getElement();
120     assertNotNull(element);
121     assertTrue(element instanceof PsiClass);
122     assertTrue(element.isValid());
123   }
124
125   public void testKeepBeltWhenDocumentModified() {
126     PsiClass aClass = myJavaFacade.findClass("AClass",GlobalSearchScope.allScope(getProject()));
127     assertNotNull(aClass);
128
129     SmartPsiElementPointer pointer = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(aClass);
130     Document document = PsiDocumentManager.getInstance(myProject).getDocument(aClass.getContainingFile());
131
132     int offset = aClass.getTextOffset();
133     document.insertString(offset, "/******/");
134
135     pointer.getElement();
136
137     document.insertString(offset, "/**/");
138     PsiDocumentManager.getInstance(myProject).commitAllDocuments();
139
140     PsiElement element = pointer.getElement();
141     assertNotNull(element);
142     assertTrue(element instanceof PsiClass);
143     assertTrue(element.isValid());
144   }
145
146   public void testChangeInPsi() {
147     PsiClass aClass = myJavaFacade.findClass("AClass",GlobalSearchScope.allScope(getProject()));
148     assertNotNull(aClass);
149
150     SmartPsiElementPointer pointer = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(aClass);
151     Document document = PsiDocumentManager.getInstance(myProject).getDocument(aClass.getContainingFile());
152
153     int offset = aClass.getTextOffset();
154     document.insertString(offset, "/**/");
155     PsiDocumentManager.getInstance(myProject).commitAllDocuments();
156
157     PsiElement element = pointer.getElement();
158     assertNotNull(element);
159     assertTrue(element instanceof PsiClass);
160     assertTrue(element.isValid());
161   }
162
163   public void testPsiChangesWithLazyPointers() throws Exception {
164     PsiClass aClass = myJavaFacade.findClass("AClass",GlobalSearchScope.allScope(getProject()));
165     assertNotNull(aClass);
166
167     final SmartPsiElementPointer<PsiIdentifier> pointer =
168       SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(aClass.getNameIdentifier());
169     final PsiComment javadoc =
170       JavaPsiFacade.getInstance(aClass.getProject()).getElementFactory().createCommentFromText("/** javadoc */", aClass);
171     aClass.getParent().addBefore(javadoc, aClass);
172
173     final PsiIdentifier elt = pointer.getElement();
174     assertNotNull(elt);
175     assertSame(elt, aClass.getNameIdentifier());
176   }
177
178   public void testTypePointer() {
179     PsiClass aClass = myJavaFacade.findClass("AClass",GlobalSearchScope.allScope(getProject()));
180     final PsiTypeElement typeElement = myJavaFacade.findClass("Test",GlobalSearchScope.allScope(getProject())).getFields()[0].getTypeElement();
181
182     SmartPsiElementPointer typePointer = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(typeElement);
183     SmartPsiElementPointer classPointer = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(aClass);
184
185     Document aClassDocument = PsiDocumentManager.getInstance(myProject).getDocument(aClass.getContainingFile());
186     Document testDocument = PsiDocumentManager.getInstance(myProject).getDocument(typeElement.getContainingFile());
187     assertNotSame(aClassDocument, testDocument);
188
189     aClassDocument.insertString(aClass.getTextOffset(), "/**/");
190     testDocument.insertString(typeElement.getTextOffset(), "/**/");
191     PsiDocumentManager.getInstance(myProject).commitAllDocuments();
192
193     PsiElement element = typePointer.getElement();
194     assertNotNull(element);
195     assertTrue(element instanceof PsiTypeElement);
196     assertTrue(element.isValid());
197     assertEquals(classPointer.getElement(), PsiUtil.resolveClassInType(((PsiTypeElement)element).getType()));
198   }
199
200   public void testCreatePointerInBeforeDocumentChange() {
201     final PsiClass aClass = myJavaFacade.findClass("AClass",GlobalSearchScope.allScope(getProject()));
202     assertNotNull(aClass);
203
204     Document document = PsiDocumentManager.getInstance(myProject).getDocument(aClass.getContainingFile());
205
206     final SmartPsiElementPointer[] pointer = new SmartPsiElementPointer[1];
207     int offset = aClass.getTextOffset();
208     DocumentListener listener = new DocumentListener() {
209       @Override
210       public void beforeDocumentChange(DocumentEvent event) {
211         pointer[0] = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(aClass);
212       }
213
214       @Override
215       public void documentChanged(DocumentEvent event) {
216       }
217     };
218     EditorEventMulticaster multicaster = EditorFactory.getInstance().getEventMulticaster();
219     multicaster.addDocumentListener(listener);
220     try {
221       document.insertString(offset, "/******/");
222     }
223     finally {
224       multicaster.removeDocumentListener(listener);
225     }
226
227     pointer[0].getElement();
228
229     document.insertString(0, "/**/");
230     PsiDocumentManager.getInstance(myProject).commitAllDocuments();
231
232     PsiElement element = pointer[0].getElement();
233     assertNotNull(element);
234     assertTrue(element instanceof PsiClass);
235     assertTrue(element.isValid());
236   }
237
238   public void testCreatePointerWhenNoPsiFile() {
239     myPsiManager.startBatchFilesProcessingMode(); // to use weak refs
240
241     try {
242       final PsiClass aClass = myJavaFacade.findClass("AClass",GlobalSearchScope.allScope(getProject()));
243       assertNotNull(aClass);
244
245       VirtualFile vFile = myRoot.findChild("AClass.java");
246       assertNotNull(vFile);
247       PsiDocumentManager psiDocumentManager = PsiDocumentManager.getInstance(myProject);
248       Document document = FileDocumentManager.getInstance().getDocument(vFile);
249
250       final SmartPsiElementPointer pointer = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(aClass);
251
252       System.gc();
253       /*
254       PsiFile psiFile = myPsiManager.getFileManager().getCachedPsiFile(vFile);
255       assertNull(psiFile);
256       */
257
258       document.insertString(0, "class Foo{}\n");
259
260       PsiElement element = pointer.getElement();
261       assertEquals(aClass, element);
262
263       document.insertString(0, "/**/");
264       psiDocumentManager.commitAllDocuments();
265
266       if (aClass.isValid()) {
267         aClass.getChildren();
268       }
269
270       element = pointer.getElement();
271       assertNotNull(element);
272       assertTrue(element instanceof PsiClass);
273       assertTrue(element.isValid());
274     }
275     finally {
276       myPsiManager.finishBatchFilesProcessingMode(); // to use weak refs
277     }
278   }
279
280   public void testReplaceFile() throws IOException {
281     VirtualFile vfile = myRoot.createChildData(this, "X.java");
282     VfsUtil.saveText(vfile, "public class X { public int X; }");
283
284     PsiClass aClass = myJavaFacade.findClass("X", GlobalSearchScope.allScope(getProject()));
285     assertNotNull(aClass);
286     assertTrue(aClass.isValid());
287
288     SmartPsiElementPointer classp = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(aClass);
289     SmartPsiElementPointer filep = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(aClass.getContainingFile());
290
291     FileContentUtil.reparseFiles(myProject, Collections.<VirtualFile>singleton(vfile), true);
292     PsiDocumentManager.getInstance(myProject).commitAllDocuments();
293     assertFalse(aClass.isValid());
294
295     PsiElement element = classp.getElement();
296     assertNotNull(element);
297     assertTrue(element instanceof PsiClass);
298     assertTrue(element.isValid());
299     assertEquals(vfile, element.getContainingFile().getVirtualFile());
300
301     element = filep.getElement();
302     assertNotNull(element);
303     assertTrue(element instanceof PsiFile);
304     assertTrue(element.isValid());
305     assertEquals(vfile, element.getContainingFile().getVirtualFile());
306   }
307
308   public void testCreatePointerDoesNotLoadPsiTree() throws IOException {
309     VirtualFile vfile = myRoot.createChildData(this, "X.java");
310     VfsUtil.saveText(vfile, "public class X { public int X; }");
311
312     PsiClass aClass = myJavaFacade.findClass("X", GlobalSearchScope.allScope(getProject()));
313     assertNotNull(aClass);
314     assertTrue(aClass.isValid());
315
316     PsiFileImpl file = (PsiFileImpl)aClass.getContainingFile();
317
318     assertTreeLoaded(file, false);
319
320     SmartPsiElementPointer p = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(aClass);
321     assertNotNull(p);
322
323     assertTreeLoaded(file, false);
324
325     assertInstanceOf(p.getElement(), PsiClass.class);
326
327     assertTreeLoaded(file, false);
328
329     PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myProject);
330     Document document = documentManager.getDocument(file);
331     document.insertString(0, "/** asdasd */");
332     documentManager.commitAllDocuments();
333
334     // loaded tree
335     assertTreeLoaded(file, true);
336
337     assertInstanceOf(p.getElement(), PsiClass.class);
338
339     assertTreeLoaded(file, true);
340   }
341
342   private static void assertTreeLoaded(PsiFileImpl file, boolean loaded) {
343     FileElement treeElement = file.getTreeElement();
344     assertEquals(loaded, treeElement != null);
345     StubTree stubTree = file.getStubTree();
346     assertEquals(loaded, stubTree == null);
347   }
348
349   public void testPointerDisambiguationAfterDupLine() throws Exception {
350     PsiJavaFile file = (PsiJavaFile)configureByText(StdFileTypes.JAVA, "class XXX{ void foo() { \n" +
351                                        " <caret>foo();\n" +
352                                        "}}");
353     PsiClass aClass = file.getClasses()[0];
354     assertNotNull(aClass);
355
356     PsiReferenceExpression ref1 = PsiTreeUtil.getParentOfType(PsiUtilBase.getElementAtCaret(getEditor()), PsiReferenceExpression.class);
357     SmartPsiElementPointer pointer1 = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(ref1);
358
359     ctrlD();
360     PsiDocumentManager.getInstance(myProject).commitAllDocuments();
361
362     Set<PsiReferenceExpression> refs = new THashSet<PsiReferenceExpression>();
363     int offset=0;
364     while (true) {
365       offset = getEditor().getDocument().getText().indexOf("foo();", offset+1);
366       if (offset == -1) break;
367       PsiReferenceExpression ref2 = PsiTreeUtil.getParentOfType(getFile().findElementAt(offset), PsiReferenceExpression.class);
368       refs.add(ref2);
369     }
370     refs.remove(ref1);
371     assertEquals(1, refs.size());
372     PsiReferenceExpression ref2 = refs.iterator().next();
373     assertNotSame(ref1, ref2);
374     SmartPsiElementPointer pointer2 = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(ref2);
375     assertNotSame(pointer1, pointer2);
376
377     PsiElement element1 = pointer1.getElement();
378     PsiElement element2 = pointer2.getElement();
379
380     assertNotNull(element1);
381     assertNotNull(element2);
382     assertNotSame(element1, element2);
383
384     assertFalse(SmartPointerManager.getInstance(myProject).pointToTheSameElement(pointer1, pointer2));
385   }
386
387   public void testPointersRefCount() throws Exception {
388     PsiFile file = configureByText(JavaFileType.INSTANCE, "class X{}");
389     PsiClass aClass = ((PsiClassOwner)file).getClasses()[0];
390     SmartPointerManagerImpl smartPointerManager = (SmartPointerManagerImpl)SmartPointerManager.getInstance(myProject);
391     SmartPsiElementPointer pointer1 = smartPointerManager.createSmartPsiElementPointer(aClass);
392     SmartPsiElementPointer pointer2 = smartPointerManager.createSmartPsiElementPointer(aClass);
393     assertSame(pointer1, pointer2);
394
395     assertNotNull(pointer1.getRange());
396
397     boolean removed2 = smartPointerManager.removePointer(pointer2);
398     assertFalse(removed2);
399     assertNotNull(pointer1.getRange());
400
401     boolean removed1 = smartPointerManager.removePointer(pointer1);
402     assertTrue(removed1);
403     assertNull(pointer1.getRange());
404   }
405
406   public void testPointersRefCountSaturated() throws Exception {
407     PsiFile file = configureByText(JavaFileType.INSTANCE, "class X{}");
408     PsiClass aClass = ((PsiClassOwner)file).getClasses()[0];
409     SmartPointerManagerImpl smartPointerManager = (SmartPointerManagerImpl)SmartPointerManager.getInstance(myProject);
410     SmartPsiElementPointerImpl pointer1 = (SmartPsiElementPointerImpl)smartPointerManager.createSmartPsiElementPointer(aClass);
411     for (int i=0; i<1000; i++) {
412       SmartPsiElementPointer<PsiClass> pointer2 = smartPointerManager.createSmartPsiElementPointer(aClass);
413       assertSame(pointer1, pointer2);
414     }
415
416     assertNotNull(pointer1.getRange());
417     assertEquals(Byte.MAX_VALUE, pointer1.incrementAndGetReferenceCount(0));
418
419     for (int i=0; i<1100; i++) {
420       boolean removed1 = smartPointerManager.removePointer(pointer1);
421       assertFalse(removed1);
422       Assert.assertNotNull(pointer1.getRange());
423     }
424   }
425
426   public void testSmartPointerCreationDoesNotLoadDocument() {
427     PsiPackage aPackage = myJavaFacade.findPackage("java.io");
428     SmartPointerManagerImpl smartPointerManager = (SmartPointerManagerImpl)SmartPointerManager.getInstance(myProject);
429     for (PsiClass aClass : aPackage.getClasses()) {
430       PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myProject);
431       PsiFile file = aClass.getContainingFile();
432       Document document = documentManager.getCachedDocument(file);
433       if (document == null) { //ignore already loaded documents
434         SmartPsiElementPointer pointer = smartPointerManager.createSmartPsiElementPointer(aClass);
435         assertNull(documentManager.getCachedDocument(file));
436         //System.out.println("file = " + file);
437       }
438       else {
439         System.out.println("already loaded file = " + file);
440       }
441     }
442   }
443
444   public void testSmartPointersSurvivePsiFileUnload() throws IOException {
445     final VirtualFile vfile = myRoot.createChildData(this, "X.txt");
446     String xxx = "xxx";
447     String text = xxx + " " + xxx + " " + xxx;
448     VfsUtil.saveText(vfile, text);
449     PsiFile psiFile = PsiManager.getInstance(getProject()).findFile(vfile);
450     assertTrue(String.valueOf(psiFile), psiFile instanceof PsiPlainTextFile);
451     SmartPointerManagerImpl manager = (SmartPointerManagerImpl)SmartPointerManager.getInstance(myProject);
452     TextRange range1 = TextRange.from(text.indexOf(xxx), xxx.length());
453     SmartPsiFileRange pointer1 = manager.createSmartPsiFileRangePointer(psiFile, range1);
454     TextRange range2 = TextRange.from(text.lastIndexOf(xxx), xxx.length());
455     SmartPsiFileRange pointer2 = manager.createSmartPsiFileRangePointer(psiFile, range2);
456     assertNotNull(FileDocumentManager.getInstance().getCachedDocument(vfile));
457
458     SoftReference<PsiFile> ref = new SoftReference<PsiFile>(psiFile);
459     psiFile = null;
460     while (ref.get() != null) {
461       PlatformTestUtil.tryGcSoftlyReachableObjects();
462     }
463     assertNull(FileDocumentManager.getInstance().getCachedDocument(vfile));
464     assertEquals(pointer1.getRange(), range1);
465     WriteCommandAction.runWriteCommandAction(getProject(), new Runnable() {
466       @Override
467       public void run() {
468         FileDocumentManager.getInstance().getDocument(vfile).insertString(0, " ");
469       }
470     });
471     assertEquals(range1.shiftRight(1), pointer1.getRange());
472     assertEquals(range2.shiftRight(1), pointer2.getRange());
473   }
474
475   public void testInXml() {
476     final PsiFile file = configureByText(HtmlFileType.INSTANCE,
477                                          "<!doctype html>\n" +
478                                          "<html>\n" +
479                                          "    <fieldset></fieldset>\n" +
480                                          "    <select></select>\n" +
481                                          "\n" +
482                                          "    <caret>\n" +
483                                          "</html>"
484     );
485
486     final XmlTag fieldSet = PsiTreeUtil.getParentOfType(file.findElementAt(file.getText().indexOf("fieldset")), XmlTag.class);
487     assertNotNull(fieldSet);
488     assertEquals("fieldset", fieldSet.getName());
489
490     final XmlTag select = PsiTreeUtil.getParentOfType(file.findElementAt(file.getText().indexOf("select")), XmlTag.class);
491     assertNotNull(select);
492     assertEquals("select", select.getName());
493
494     final SmartPsiElementPointer<XmlTag> fieldSetPointer = SmartPointerManager.getInstance(getProject()).createSmartPsiElementPointer(
495       fieldSet);
496     final SmartPsiElementPointer<XmlTag> selectPointer = SmartPointerManager.getInstance(getProject()).createSmartPsiElementPointer(select);
497
498     WriteCommandAction.runWriteCommandAction(getProject(), new Runnable() {
499       @Override
500       public void run() {
501         getEditor().getDocument().insertString(getEditor().getCaretModel().getOffset(), "<a></a>");
502       }
503     });
504
505     PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
506
507     final XmlTag newFieldSet = fieldSetPointer.getElement();
508     assertNotNull(newFieldSet);
509     assertEquals("fieldset", newFieldSet.getName());
510
511     final XmlTag newSelect = selectPointer.getElement();
512     assertNotNull(newSelect);
513     assertEquals("select", newSelect.getName());
514   }
515   public void testInsertImport() {
516     final PsiFile file = configureByText(JavaFileType.INSTANCE,
517                                          "class S {\n" +
518                                          "}");
519
520     PsiClass aClass = ((PsiJavaFile)file).getClasses()[0];
521
522     WriteCommandAction.runWriteCommandAction(getProject(), new Runnable() {
523       @Override
524       public void run() {
525         getEditor().getDocument().insertString(0, "import java.util.Map;\n");
526       }
527     });
528
529     PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
530
531     PsiClass aClass2 = ((PsiJavaFile)file).getClasses()[0];
532     assertSame(aClass, aClass2);
533   }
534 }