Source

netbeans-no-javac-patch / no-javac-patch

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
# HG changeset patch
# Parent 30f2f146ec8261083ab5478ee860e7bddf591592

diff --git a/java.source/src/org/netbeans/api/java/source/TreeUtilities.java b/java.source/src/org/netbeans/api/java/source/TreeUtilities.java
--- a/java.source/src/org/netbeans/api/java/source/TreeUtilities.java
+++ b/java.source/src/org/netbeans/api/java/source/TreeUtilities.java
@@ -53,14 +53,24 @@
 import com.sun.tools.javac.code.Flags;
 import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.comp.Attr;
 import com.sun.tools.javac.comp.AttrContext;
 import com.sun.tools.javac.comp.Enter;
 import com.sun.tools.javac.comp.Env;
 import com.sun.tools.javac.comp.Resolve;
+import com.sun.tools.javac.main.JavaCompiler;
+import com.sun.tools.javac.parser.JavacParser;
+import com.sun.tools.javac.parser.Parser;
+import com.sun.tools.javac.parser.ParserFactory;
 import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.JCBlock;
 import com.sun.tools.javac.tree.JCTree.JCClassDecl;
+import com.sun.tools.javac.tree.JCTree.JCExpression;
 import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
+import com.sun.tools.javac.tree.JCTree.JCStatement;
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Log;
+import java.nio.CharBuffer;
 import java.util.*;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -70,6 +80,9 @@
 import javax.lang.model.type.TypeMirror;
 import javax.lang.model.type.UnionType;
 import javax.lang.model.util.Types;
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticListener;
+import javax.tools.JavaFileObject;
 import org.netbeans.api.annotations.common.CheckForNull;
 import org.netbeans.api.annotations.common.NonNull;
 import org.netbeans.api.java.lexer.JavaTokenId;
@@ -78,8 +91,10 @@
 import org.netbeans.modules.java.source.builder.CommentHandlerService;
 import org.netbeans.modules.java.source.builder.CommentSetImpl;
 import org.netbeans.lib.nbjavac.services.NBTreeMaker.IndexedClassDecl;
+import org.netbeans.modules.java.source.JavaSourceAccessor;
 import org.netbeans.modules.java.source.pretty.ImportAnalysis2;
 import org.netbeans.modules.java.source.transform.ImmutableTreeTranslator;
+import org.netbeans.modules.java.source.usages.ClasspathInfoAccessor;
 
 /**
  *
@@ -389,7 +404,7 @@
         com.sun.tools.javac.tree.TreeMaker jcMaker = com.sun.tools.javac.tree.TreeMaker.instance(info.impl.getJavacTask().getContext());
         int oldPos = jcMaker.pos;
         try {
-            return info.impl.getJavacTask().parseType(expr);
+            return parseType(expr);
         } finally {
             jcMaker.pos = oldPos;
         }
@@ -406,7 +421,7 @@
         int oldPos = jcMaker.pos;
         
         try {
-            return (StatementTree)info.impl.getJavacTask().parseStatement(stmt, sourcePositions);
+            return (StatementTree)parseStatement(stmt, sourcePositions, new DiscardDiagnosticListener());
         } finally {
             jcMaker.pos = oldPos;
         }
@@ -423,7 +438,7 @@
         int oldPos = jcMaker.pos;
         
         try {
-            return (ExpressionTree) info.impl.getJavacTask().parseExpression(expr, sourcePositions);
+            return (ExpressionTree) parseExpression(expr, sourcePositions, new DiscardDiagnosticListener());
         } finally {
             jcMaker.pos = oldPos;
         }
@@ -440,7 +455,7 @@
         int oldPos = jcMaker.pos;
         
         try {
-            return (ExpressionTree)info.impl.getJavacTask().parseVariableInitializer(init, sourcePositions);
+            return (ExpressionTree) parseVariableInitializer(init, sourcePositions, new DiscardDiagnosticListener());
         } finally {
             jcMaker.pos = oldPos;
         }
@@ -457,7 +472,7 @@
         int oldPos = jcMaker.pos;
         
         try {
-            return (BlockTree)info.impl.getJavacTask().parseStaticBlock(block, sourcePositions);
+            return (BlockTree) parseStaticBlock(block, sourcePositions, new DiscardDiagnosticListener());
         } finally {
             jcMaker.pos = oldPos;
         }
@@ -524,7 +539,7 @@
     /**Attribute the given tree in the given context.
      */
     public TypeMirror attributeTree(Tree tree, Scope scope) {
-        return info.impl.getJavacTask().attributeTree((JCTree)tree, ((JavacScope)scope).getEnv());
+        return attributeTreeImpl((JCTree)tree, ((JavacScope)scope).getEnv());
     }
     
     //XXX dbalek:
@@ -532,21 +547,21 @@
      * Returns scope valid at point when <code>to</code> is reached.
      */
     public Scope attributeTreeTo(Tree tree, Scope scope, Tree to) {
-        return info.impl.getJavacTask().attributeTreeTo((JCTree)tree, ((JavacScope)scope).getEnv(), (JCTree)to);
+        return attributeTreeToImpl((JCTree)tree, ((JavacScope)scope).getEnv(), (JCTree)to);
     }
     
     //XXX dbalek:
     public TypeMirror reattributeTree(Tree tree, Scope scope) {
         Env<AttrContext> env = ((JavacScope)scope).getEnv();
         copyInnerClassIndexes(env.tree, tree);
-        return info.impl.getJavacTask().attributeTree((JCTree)tree, env);
+        return attributeTreeImpl((JCTree)tree, env);
     }
     
     //XXX dbalek:
     public Scope reattributeTreeTo(Tree tree, Scope scope, Tree to) {
         Env<AttrContext> env = ((JavacScope)scope).getEnv();
         copyInnerClassIndexes(env.tree, tree);
-        return info.impl.getJavacTask().attributeTreeTo((JCTree)tree, env, (JCTree)to);
+        return attributeTreeToImpl((JCTree)tree, env, (JCTree)to);
     }
     
     /**Returns tokens for a given tree.
@@ -1185,4 +1200,134 @@
 
         return attributeTreeImpl != null && attributeTreeImpl.constValue() != null;
     }
+
+    Tree parseTypeImpl(String expr) {
+        if (expr == null || expr.equals(""))
+            throw new IllegalArgumentException();
+        JavaCompiler compiler = JavaCompiler.instance(JavaSourceAccessor.getINSTANCE().getCompilationInfoImpl(info).getJavacTask().getContext());
+        JavaFileObject prev = compiler.log.useSource(null);
+//        boolean old = compiler.log.suppressErrorsAndWarnings;
+//        compiler.log.suppressErrorsAndWarnings = true;
+        ParserFactory parserFactory = ParserFactory.instance(JavaSourceAccessor.getINSTANCE().getCompilationInfoImpl(info).getJavacTask().getContext());
+        Attr attr = Attr.instance(JavaSourceAccessor.getINSTANCE().getCompilationInfoImpl(info).getJavacTask().getContext());
+        try {
+            CharBuffer buf = CharBuffer.wrap((expr+"\u0000").toCharArray(), 0, expr.length());
+//            Parser parser = parserFactory.newParser(buf, false, false, false, true);
+            Parser parser = parserFactory.newParser(buf, false, false, false);
+            return parser.parseType();
+        } finally {
+//            compiler.log.suppressErrorsAndWarnings = old;
+            compiler.log.useSource(prev);
+        }
+    }
+
+    public JCStatement parseStatement(CharSequence stmt, SourcePositions[] pos, DiagnosticListener<? super JavaFileObject> errors) {
+        return (JCStatement) doParse(ParseKind.STATEMENT, stmt, pos, errors);
+    }
+
+    private JCTree doParse(ParseKind kind, CharSequence source, SourcePositions[] pos, DiagnosticListener<? super JavaFileObject> errors) {
+        if (source == null || (pos != null && pos.length != 1))
+            throw new IllegalArgumentException();
+        JavaCompiler compiler = JavaCompiler.instance(JavaSourceAccessor.getINSTANCE().getCompilationInfoImpl(info).getJavacTask().getContext());
+        JavaFileObject prev = compiler.log.useSource(null);
+//        boolean old = compiler.log.suppressErrorsAndWarnings;
+        DiagnosticListener<? super JavaFileObject> oldListener = compiler.log.getDiagnosticListener();
+        int oldErrors = compiler.log.nerrors;
+        int oldWarnings = compiler.log.nwarnings;
+//        compiler.log.suppressErrorsAndWarnings = false;
+        compiler.log.setDiagnosticListener(errors);
+        ParserFactory parserFactory = ParserFactory.instance(JavaSourceAccessor.getINSTANCE().getCompilationInfoImpl(info).getJavacTask().getContext());
+        try {
+            CharBuffer buf = CharBuffer.wrap((source+"\u0000").toCharArray(), 0, source.length());
+//            Parser parser = parserFactory.newParser(buf, false, true, false, true);
+            Parser parser = parserFactory.newParser(buf, false, true, false);
+            if (parser instanceof JavacParser) {
+                if (pos != null)
+                    pos[0] = new ParserSourcePositions((JavacParser)parser);
+                switch (kind) {
+                    case STATEMENT: return parser.parseStatement();
+                    case EXPRESSION: return parser.parseExpression();
+                    case VARIABLE_INIT: return ((JavacParser)parser).variableInitializer();
+                    case STATIC_BLOCK:
+                        com.sun.tools.javac.util.List<JCTree> trees = ((JavacParser)parser).classOrInterfaceBodyDeclaration(null, false);
+                        return trees.head != null && trees.head.getTag() == JCTree.Tag.BLOCK ? (JCBlock) trees.head : null;
+                    default: throw new UnsupportedOperationException(kind.name());
+                }
+                
+            }
+            return null;
+        } finally {
+//            compiler.log.suppressErrorsAndWarnings = old;
+            compiler.log.setDiagnosticListener(oldListener);
+            compiler.log.useSource(prev);
+            compiler.log.nerrors = oldErrors;
+            compiler.log.nwarnings = oldWarnings;
+        }
+    }
+
+    public JCExpression parseExpression(CharSequence expr, SourcePositions[] pos, DiagnosticListener<? super JavaFileObject> errors) {
+        return (JCExpression) doParse(ParseKind.EXPRESSION, expr, pos, errors);
+    }
+
+    public JCExpression parseVariableInitializer(CharSequence init, SourcePositions[] pos, DiagnosticListener<? super JavaFileObject> errors) {
+        return (JCExpression) doParse(ParseKind.VARIABLE_INIT, init, pos, errors);
+    }
+
+    public JCBlock parseStaticBlock(CharSequence block, SourcePositions[] pos, DiagnosticListener<? super JavaFileObject> errors) {
+        return (JCBlock) doParse(ParseKind.STATIC_BLOCK, block, pos, errors);
+    }
+
+    private enum ParseKind {STATEMENT, EXPRESSION, VARIABLE_INIT, STATIC_BLOCK;}
+
+    private class ParserSourcePositions implements SourcePositions {
+
+        private JavacParser parser;
+
+        private ParserSourcePositions(JavacParser parser) {
+            this.parser = parser;
+        }
+
+        public long getStartPosition(CompilationUnitTree file, Tree tree) {
+            return parser.getStartPos((JCTree)tree);
+        }
+
+        public long getEndPosition(CompilationUnitTree file, Tree tree) {
+            return parser.getEndPos((JCTree)tree);
+        }
+    }
+
+    private static final class DiscardDiagnosticListener implements DiagnosticListener<JavaFileObject> {
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {}
+    }
+    
+    private Type attributeTreeImpl(JCTree tree, Env<AttrContext>env) {
+        Log log = Log.instance(JavaSourceAccessor.getINSTANCE().getCompilationInfoImpl(info).getJavacTask().getContext());
+        Attr attr = Attr.instance(JavaSourceAccessor.getINSTANCE().getCompilationInfoImpl(info).getJavacTask().getContext());
+        JavaFileObject prev = log.useSource(null);
+//        boolean old = log.suppressErrorsAndWarnings;
+//        log.suppressErrorsAndWarnings = true;
+        try {
+            if (tree instanceof JCExpression)
+                return attr.attribExpr(tree, env, Type.noType);
+            return attr.attribStat(tree, env);
+        } finally {
+//            log.suppressErrorsAndWarnings = old;
+            log.useSource(prev);
+        }
+    }
+
+    private JavacScope attributeTreeToImpl(JCTree tree, Env<AttrContext>env, JCTree to) {
+        Log log = Log.instance(JavaSourceAccessor.getINSTANCE().getCompilationInfoImpl(info).getJavacTask().getContext());
+        Attr attr = Attr.instance(JavaSourceAccessor.getINSTANCE().getCompilationInfoImpl(info).getJavacTask().getContext());
+        JavaFileObject prev = log.useSource(null);
+//        boolean old = log.suppressErrorsAndWarnings;
+//        log.suppressErrorsAndWarnings = true;
+        try {
+            Env<AttrContext> ret = tree instanceof JCExpression ? attr.attribExprToTree(tree, env, to) : attr.attribStatToTree(tree, env, to);
+            return new JavacScope(ret);
+        } finally {
+//            log.suppressErrorsAndWarnings = old;
+            log.useSource(prev);
+        }
+    }
 }
diff --git a/java.source/src/org/netbeans/modules/java/source/PostFlowAnalysis.java b/java.source/src/org/netbeans/modules/java/source/PostFlowAnalysis.java
--- a/java.source/src/org/netbeans/modules/java/source/PostFlowAnalysis.java
+++ b/java.source/src/org/netbeans/modules/java/source/PostFlowAnalysis.java
@@ -196,7 +196,7 @@
                 Symbol c = meth.owner;
                 if (c.hasOuterInstance()) {
                     checkThis = false;
-                    if (tree.meth.getTag() != JCTree.SELECT && ((c.owner.kind & (Kinds.MTH | Kinds.VAR)) != 0 || methName == names._this)) {
+                    if (tree.meth.getTag() != JCTree.Tag.SELECT && ((c.owner.kind & (Kinds.MTH | Kinds.VAR)) != 0 || methName == names._this)) {
                         checkThis(tree.meth.pos(), c.type.getEnclosingType().tsym);
                     }
                 }
diff --git a/java.source/src/org/netbeans/modules/java/source/TreeLoader.java b/java.source/src/org/netbeans/modules/java/source/TreeLoader.java
--- a/java.source/src/org/netbeans/modules/java/source/TreeLoader.java
+++ b/java.source/src/org/netbeans/modules/java/source/TreeLoader.java
@@ -171,10 +171,10 @@
                         log.nerrors = 0;
                         JavaFileObject jfo = FileObjects.nbFileObject(fo, null);
                         Map<ClassSymbol, StringBuilder> oldCouplingErrors = couplingErrors;
-                        boolean oldSkipAPT = jc.skipAnnotationProcessing;
+//                        boolean oldSkipAPT = jc.skipAnnotationProcessing;
                         try {
                             couplingErrors = new HashMap<ClassSymbol, StringBuilder>();
-                            jc.skipAnnotationProcessing = true;
+//                            jc.skipAnnotationProcessing = true;
                             jti.analyze(jti.enter(jti.parse(jfo)));
                             if (persist) {
                                 if (canWrite(cpInfo)) {
@@ -205,7 +205,7 @@
                             }
                             return true;
                         } finally {
-                            jc.skipAnnotationProcessing = oldSkipAPT;
+//                            jc.skipAnnotationProcessing = oldSkipAPT;
                             log.nerrors = 0;
                             for (Map.Entry<ClassSymbol, StringBuilder> e : couplingErrors.entrySet()) {
                                 dumpCouplingAbort(new CouplingAbort(e.getKey(), null), e.getValue().toString());
@@ -301,7 +301,7 @@
                     List<JCTree> prev = null;
                     for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
                         scan(l.head);
-                        if (l.head.getTag() == JCTree.BLOCK) {
+                        if (l.head.getTag() == JCTree.Tag.BLOCK) {
                             if (prev != null)
                                 prev.tail = l.tail;
                             else
@@ -314,8 +314,8 @@
         }.scan(env.toplevel);
         Log log = Log.instance(jti.getContext());
         JavaFileObject prevLogTo = log.useSource(null);
-        boolean oldSuppress = log.suppressErrorsAndWarnings;
-        log.suppressErrorsAndWarnings = true;
+//        boolean oldSuppress = log.suppressErrorsAndWarnings;
+//        log.suppressErrorsAndWarnings = true;
         try {
             String binaryName = null;
             String surl = null;
@@ -352,7 +352,7 @@
             LOGGER.log(Level.INFO, "InvalidSourcePath reported when writing sym file for class: {0}", clazz.flatname); // NOI18N
         } finally {
             jfm.handleOption("output-root", Collections.singletonList("").iterator()); //NOI18N
-            log.suppressErrorsAndWarnings = oldSuppress;
+//            log.suppressErrorsAndWarnings = oldSuppress;
             log.useSource(prevLogTo);
         }
     }
@@ -594,7 +594,7 @@
                                     List<VarSymbol> params = sym.params;
                                     if (checkParamTypes(params, paramTypes)) {
                                         for (String name : paramNames) {
-                                            params.head.setName(clazz.name.table.fromString(name));
+//                                            params.head.setName(clazz.name.table.fromString(name));
                                             params = params.tail;
                                         }
                                     }
@@ -658,7 +658,7 @@
                 for (VarSymbol vs : ms.getParameters()) {
                     String name = JavaSourceAccessor.getINSTANCE().generateReadableParameterName(vs.asType().toString(), usedNames);
 
-                    vs.setName(clazz.name.table.fromString(name));
+//                    vs.setName(clazz.name.table.fromString(name));
                 }
             }
         }
diff --git a/java.source/src/org/netbeans/modules/java/source/builder/TreeFactory.java b/java.source/src/org/netbeans/modules/java/source/builder/TreeFactory.java
--- a/java.source/src/org/netbeans/modules/java/source/builder/TreeFactory.java
+++ b/java.source/src/org/netbeans/modules/java/source/builder/TreeFactory.java
@@ -139,27 +139,27 @@
     }
     
     public BinaryTree Binary(Kind operator, ExpressionTree left, ExpressionTree right) {
-        final int op;
+        final Tag op;
         switch (operator) {
-            case MULTIPLY: op = JCTree.MUL; break;
-            case DIVIDE: op = JCTree.DIV; break;
-            case REMAINDER: op = JCTree.MOD; break;
-            case PLUS: op = JCTree.PLUS; break;
-            case MINUS: op = JCTree.MINUS; break;
-            case LEFT_SHIFT: op = JCTree.SL; break;
-            case RIGHT_SHIFT: op = JCTree.SR; break;
-            case UNSIGNED_RIGHT_SHIFT: op = JCTree.USR; break;
-            case LESS_THAN: op = JCTree.LT; break;
-            case GREATER_THAN: op = JCTree.GT; break;
-            case LESS_THAN_EQUAL: op = JCTree.LE; break;
-            case GREATER_THAN_EQUAL: op = JCTree.GE; break;
-            case EQUAL_TO: op = JCTree.EQ; break;
-            case NOT_EQUAL_TO: op = JCTree.NE; break;
-            case AND: op = JCTree.BITAND; break;
-            case XOR: op = JCTree.BITXOR; break;
-            case OR: op = JCTree.BITOR; break;
-            case CONDITIONAL_AND: op = JCTree.AND; break;
-            case CONDITIONAL_OR: op = JCTree.OR; break;
+            case MULTIPLY: op = JCTree.Tag.MUL; break;
+            case DIVIDE: op = JCTree.Tag.DIV; break;
+            case REMAINDER: op = JCTree.Tag.MOD; break;
+            case PLUS: op = JCTree.Tag.PLUS; break;
+            case MINUS: op = JCTree.Tag.MINUS; break;
+            case LEFT_SHIFT: op = JCTree.Tag.SL; break;
+            case RIGHT_SHIFT: op = JCTree.Tag.SR; break;
+            case UNSIGNED_RIGHT_SHIFT: op = JCTree.Tag.USR; break;
+            case LESS_THAN: op = JCTree.Tag.LT; break;
+            case GREATER_THAN: op = JCTree.Tag.GT; break;
+            case LESS_THAN_EQUAL: op = JCTree.Tag.LE; break;
+            case GREATER_THAN_EQUAL: op = JCTree.Tag.GE; break;
+            case EQUAL_TO: op = JCTree.Tag.EQ; break;
+            case NOT_EQUAL_TO: op = JCTree.Tag.NE; break;
+            case AND: op = JCTree.Tag.BITAND; break;
+            case XOR: op = JCTree.Tag.BITXOR; break;
+            case OR: op = JCTree.Tag.BITOR; break;
+            case CONDITIONAL_AND: op = JCTree.Tag.AND; break;
+            case CONDITIONAL_OR: op = JCTree.Tag.OR; break;
             default:
                 throw new IllegalArgumentException("Illegal binary operator: " + operator);
         }
@@ -265,19 +265,19 @@
     public CompoundAssignmentTree CompoundAssignment(Kind operator, 
                                                      ExpressionTree variable, 
                                                      ExpressionTree expression) {
-        final int op;
+        final Tag op;
         switch (operator) {
-            case MULTIPLY_ASSIGNMENT: op = JCTree.MUL_ASG; break;
-            case DIVIDE_ASSIGNMENT: op = JCTree.DIV_ASG; break;
-            case REMAINDER_ASSIGNMENT: op = JCTree.MOD_ASG; break;
-            case PLUS_ASSIGNMENT: op = JCTree.PLUS_ASG; break;
-            case MINUS_ASSIGNMENT: op = JCTree.MINUS_ASG; break;
-            case LEFT_SHIFT_ASSIGNMENT: op = JCTree.SL_ASG; break;
-            case RIGHT_SHIFT_ASSIGNMENT: op = JCTree.SR_ASG; break;
-            case UNSIGNED_RIGHT_SHIFT_ASSIGNMENT: op = JCTree.USR_ASG; break;
-            case AND_ASSIGNMENT: op = JCTree.BITAND_ASG; break;
-            case XOR_ASSIGNMENT: op = JCTree.BITXOR_ASG; break;
-            case OR_ASSIGNMENT: op = JCTree.BITOR_ASG; break;
+            case MULTIPLY_ASSIGNMENT: op = JCTree.Tag.MUL_ASG; break;
+            case DIVIDE_ASSIGNMENT: op = JCTree.Tag.DIV_ASG; break;
+            case REMAINDER_ASSIGNMENT: op = JCTree.Tag.MOD_ASG; break;
+            case PLUS_ASSIGNMENT: op = JCTree.Tag.PLUS_ASG; break;
+            case MINUS_ASSIGNMENT: op = JCTree.Tag.MINUS_ASG; break;
+            case LEFT_SHIFT_ASSIGNMENT: op = JCTree.Tag.SL_ASG; break;
+            case RIGHT_SHIFT_ASSIGNMENT: op = JCTree.Tag.SR_ASG; break;
+            case UNSIGNED_RIGHT_SHIFT_ASSIGNMENT: op = JCTree.Tag.USR_ASG; break;
+            case AND_ASSIGNMENT: op = JCTree.Tag.BITAND_ASG; break;
+            case XOR_ASSIGNMENT: op = JCTree.Tag.BITXOR_ASG; break;
+            case OR_ASSIGNMENT: op = JCTree.Tag.BITOR_ASG; break;
             default:
                 throw new IllegalArgumentException("Illegal binary operator: " + operator);
         }
@@ -698,16 +698,16 @@
     }
     
     public UnaryTree Unary(Kind operator, ExpressionTree arg) {
-        final int op;
+        final Tag op;
         switch (operator) {
-            case POSTFIX_INCREMENT: op = JCTree.POSTINC; break;
-            case POSTFIX_DECREMENT: op = JCTree.POSTDEC; break;
-            case PREFIX_INCREMENT: op = JCTree.PREINC; break;
-            case PREFIX_DECREMENT: op = JCTree.PREDEC; break;
-            case UNARY_PLUS: op = JCTree.POS; break;
-            case UNARY_MINUS: op = JCTree.NEG; break;
-            case BITWISE_COMPLEMENT: op = JCTree.COMPL; break;
-            case LOGICAL_COMPLEMENT: op = JCTree.NOT; break;
+            case POSTFIX_INCREMENT: op = JCTree.Tag.POSTINC; break;
+            case POSTFIX_DECREMENT: op = JCTree.Tag.POSTDEC; break;
+            case PREFIX_INCREMENT: op = JCTree.Tag.PREINC; break;
+            case PREFIX_DECREMENT: op = JCTree.Tag.PREDEC; break;
+            case UNARY_PLUS: op = JCTree.Tag.POS; break;
+            case UNARY_MINUS: op = JCTree.Tag.NEG; break;
+            case BITWISE_COMPLEMENT: op = JCTree.Tag.COMPL; break;
+            case LOGICAL_COMPLEMENT: op = JCTree.Tag.NOT; break;
             default:
                 throw new IllegalArgumentException("Illegal unary operator: " + operator);
         }
diff --git a/java.source/src/org/netbeans/modules/java/source/indexing/SuperOnePassCompileWorker.java b/java.source/src/org/netbeans/modules/java/source/indexing/SuperOnePassCompileWorker.java
--- a/java.source/src/org/netbeans/modules/java/source/indexing/SuperOnePassCompileWorker.java
+++ b/java.source/src/org/netbeans/modules/java/source/indexing/SuperOnePassCompileWorker.java
@@ -215,7 +215,7 @@
                 }
                 List<TypeElement> activeTypes = new ArrayList<TypeElement>();
                 for (Tree tree : unit.first.getTypeDecls()) {
-                    if (tree instanceof JCTree && ((JCTree)tree).getTag() == JCTree.CLASSDEF) {
+                    if (tree instanceof JCTree && ((JCTree)tree).getTag() == JCTree.Tag.CLASSDEF) {
                         ClassSymbol sym = ((JCClassDecl)tree).sym;
                         if (sym != null)
                             activeTypes.add(sym);
diff --git a/java.source/src/org/netbeans/modules/java/source/matching/CopyFinder.java b/java.source/src/org/netbeans/modules/java/source/matching/CopyFinder.java
--- a/java.source/src/org/netbeans/modules/java/source/matching/CopyFinder.java
+++ b/java.source/src/org/netbeans/modules/java/source/matching/CopyFinder.java
@@ -1415,7 +1415,7 @@
         Element pEl    = info.getTrees().getElement(p);
 
         if (nodeEl == null) {
-            return pEl == null ? VerifyResult.MATCH : VerifyResult.NO_MATCH_CONTINUE; //TODO: correct? shouldn't be MATCH_CHECK_DEEPER?
+            return pEl == null ? VerifyResult.MATCH_CHECK_DEEPER : VerifyResult.NO_MATCH_CONTINUE; //TODO: correct? shouldn't be MATCH_CHECK_DEEPER?
         }
 
         VerifyResult matchingResult;
diff --git a/java.source/src/org/netbeans/modules/java/source/parsing/JavacParser.java b/java.source/src/org/netbeans/modules/java/source/parsing/JavacParser.java
--- a/java.source/src/org/netbeans/modules/java/source/parsing/JavacParser.java
+++ b/java.source/src/org/netbeans/modules/java/source/parsing/JavacParser.java
@@ -42,28 +42,19 @@
 
 package org.netbeans.modules.java.source.parsing;
 
-import com.sun.source.tree.ClassTree;
 import com.sun.source.tree.CompilationUnitTree;
 import com.sun.source.tree.MethodTree;
-import com.sun.source.tree.Tree;
-import com.sun.source.util.TreePath;
 import com.sun.source.util.Trees;
 import com.sun.tools.javac.api.ClassNamesForFileOraculum;
 import com.sun.tools.javac.api.DuplicateClassChecker;
 import com.sun.tools.javac.api.JavacTaskImpl;
 import com.sun.tools.javac.api.JavacTool;
-import com.sun.tools.javac.api.JavacTrees;
-import com.sun.tools.javac.tree.JCTree;
-import com.sun.tools.javac.tree.JCTree.JCBlock;
-import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
-import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
+import com.sun.tools.javac.api.MultiTaskListener;
 import com.sun.tools.javac.util.Abort;
 import org.netbeans.lib.nbjavac.services.CancelAbort;
 import org.netbeans.lib.nbjavac.services.CancelService;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.CouplingAbort;
-import com.sun.tools.javac.util.Log;
-import com.sun.tools.javac.util.Position.LineMapImpl;
 import com.sun.tools.javadoc.Messager;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
@@ -80,7 +71,6 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.EnumMap;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
@@ -94,7 +84,6 @@
 import  javax.swing.event.ChangeListener;
 import javax.swing.text.Document;
 import javax.swing.text.JTextComponent;
-import javax.tools.Diagnostic;
 import javax.tools.DiagnosticListener;
 import javax.tools.JavaCompiler;
 import javax.tools.JavaFileObject;
@@ -128,6 +117,7 @@
 import org.netbeans.modules.java.source.indexing.FQN2Files;
 import org.netbeans.lib.nbjavac.services.NBAttr;
 import org.netbeans.lib.nbjavac.services.NBClassReader;
+import org.netbeans.lib.nbjavac.services.NBJavadocClassReader;
 import org.netbeans.lib.nbjavac.services.NBEnter;
 import org.netbeans.lib.nbjavac.services.NBJavadocEnter;
 import org.netbeans.lib.nbjavac.services.NBJavadocMemberEnter;
@@ -136,7 +126,6 @@
 import org.netbeans.lib.nbjavac.services.NBClassWriter;
 import org.netbeans.lib.nbjavac.services.NBJavacTrees;
 import org.netbeans.lib.nbjavac.services.NBTreeMaker;
-import org.netbeans.lib.nbjavac.services.PartialReparser;
 import org.netbeans.modules.java.source.tasklist.CompilerSettings;
 import org.netbeans.modules.java.source.usages.ClassIndexImpl;
 import org.netbeans.modules.java.source.usages.ClasspathInfoAccessor;
@@ -761,15 +750,21 @@
             options.add("-proc:none"); // NOI18N, Disable annotation processors
         }
 
-        JavaCompiler tool = JavacTool.create();
-        JavacTaskImpl task = (JavacTaskImpl)tool.getTask(null, 
-                ClasspathInfoAccessor.getINSTANCE().getFileManager(cpInfo),
-                diagnosticListener, options, null, Collections.<JavaFileObject>emptySet());
+        Context context = new Context();
+        //need to preregister the Messages here, because the getTask below requires Log instance:
+        Messager.preRegister(context, null, DEV_NULL, DEV_NULL, DEV_NULL);
+        JavacTaskImpl task = (JavacTaskImpl)JavacTool.create().getTask(null, 
+                 ClasspathInfoAccessor.getINSTANCE().getFileManager(cpInfo),
+                diagnosticListener, options, null, Collections.<JavaFileObject>emptySet(),
+                context);
         if (aptEnabled) {
             task.setProcessors(processors);
         }
-        Context context = task.getContext();
-        NBClassReader.preRegister(context, !backgroundCompilation);
+        if (backgroundCompilation) {
+            NBClassReader.preRegister(context);
+        } else {
+            NBJavadocClassReader.preRegister(context);
+        }
         if (cnih != null) {
             context.put(ClassNamesForFileOraculum.class, cnih);
         }
@@ -779,7 +774,6 @@
         if (cancelService != null) {
             DefaultCancelService.preRegister(context, cancelService);
         }
-        Messager.preRegister(context, null, DEV_NULL, DEV_NULL, DEV_NULL);
         NBAttr.preRegister(context);
         NBClassWriter.preRegister(context);
         NBParserFactory.preRegister(context);
@@ -924,148 +918,149 @@
             final Snapshot snapshot,
             final MethodTree orig,
             final String newBody) throws IOException {
-        assert ci != null;
-        final FileObject fo = ci.getFileObject();
-        if (LOGGER.isLoggable(Level.FINER)) {
-            LOGGER.log(Level.FINER, "Reparse method in: {0}", fo);          //NOI18N
-        }
-        if (((JCMethodDecl)orig).localEnv == null) {
-            //We are seeing interface method or abstract or native method with body.
-            //Don't do any optimalization of this broken code - has no attr env.
-            return false;
-        }
-        final Phase currentPhase = ci.getPhase();
-        if (Phase.PARSED.compareTo(currentPhase) > 0) {
-            return false;
-        }
-        try {
-            final CompilationUnitTree cu = ci.getCompilationUnit();
-            if (cu == null || newBody == null) {
-                return false;
-            }
-            final JavacTaskImpl task = ci.getJavacTask();
-            PartialReparser pr = PartialReparser.instance(task.getContext());
-            final JavacTrees jt = JavacTrees.instance(task);
-            final int origStartPos = (int) jt.getSourcePositions().getStartPosition(cu, orig.getBody());
-            final int origEndPos = (int) jt.getSourcePositions().getEndPosition(cu, orig.getBody());
-            if (origStartPos > origEndPos) {
-                LOGGER.log(Level.WARNING, "Javac returned startpos: {0} > endpos: {1}", new Object[]{origStartPos, origEndPos});  //NOI18N
-                return false;
-            }
-            final FindAnonymousVisitor fav = new FindAnonymousVisitor();
-            fav.scan(orig.getBody(), null);
-            if (fav.hasLocalClass) {
-                if (LOGGER.isLoggable(Level.FINER)) {
-                    LOGGER.log(Level.FINER, "Skeep reparse method (old local classes): {0}", fo);   //NOI18N
-                }
-                return false;
-            }
-            final int firstInner = fav.firstInner;
-            final int noInner = fav.noInner;
-            final Context ctx = task.getContext();
-            final TreeLoader treeLoader = TreeLoader.instance(ctx);
-            if (treeLoader != null) {
-                treeLoader.startPartialReparse();
-            }
-            try {
-                final Log l = Log.instance(ctx);
-                l.startPartialReparse();
-                final JavaFileObject prevLogged = l.useSource(cu.getSourceFile());
-                JCBlock block;
-                try {
-                    DiagnosticListener dl = ci.getDiagnosticListener();
-                    assert dl instanceof CompilationInfoImpl.DiagnosticListenerImpl;
-                    ((CompilationInfoImpl.DiagnosticListenerImpl)dl).startPartialReparse(origStartPos, origEndPos);
-                    long start = System.currentTimeMillis();
-                    Map<JCTree,String> docComments = new HashMap<JCTree, String>();
-                    block = pr.reparseMethodBody(cu, orig, newBody, firstInner, docComments);
-                    if (LOGGER.isLoggable(Level.FINER)) {
-                        LOGGER.log(Level.FINER, "Reparsed method in: {0}", fo);     //NOI18N
-                    }
-                    assert block != null;
-                    fav.reset();
-                    fav.scan(block, null);
-                    final int newNoInner = fav.noInner;
-                    if (fav.hasLocalClass || noInner != newNoInner) {
-                        if (LOGGER.isLoggable(Level.FINER)) {
-                            LOGGER.log(Level.FINER, "Skeep reparse method (new local classes): {0}", fo);   //NOI18N
-                        }
-                        return false;
-                    }
-                    ((JCTree.JCCompilationUnit)cu).docComments.keySet().removeAll(fav.docOwners);
-                    ((JCTree.JCCompilationUnit)cu).docComments.putAll(docComments);
-                    long end = System.currentTimeMillis();
-                    if (fo != null) {
-                        logTime (fo,Phase.PARSED,(end-start));
-                    }
-                    final int newEndPos = (int) jt.getSourcePositions().getEndPosition(cu, block);
-                    final int delta = newEndPos - origEndPos;
-                    final Map<JCTree,Integer> endPos = ((JCCompilationUnit)cu).endPositions;
-                    final TranslatePositionsVisitor tpv = new TranslatePositionsVisitor(orig, endPos, delta);
-                    tpv.scan(cu, null);
-                    ((JCMethodDecl)orig).body = block;
-                    if (Phase.RESOLVED.compareTo(currentPhase)<=0) {
-                        start = System.currentTimeMillis();
-                        pr.reattrMethodBody(orig, block);
-                        if (LOGGER.isLoggable(Level.FINER)) {
-                            LOGGER.log(Level.FINER, "Resolved method in: {0}", fo);     //NOI18N
-                        }
-                        if (!((CompilationInfoImpl.DiagnosticListenerImpl)dl).hasPartialReparseErrors()) {
-                            final JavacFlowListener fl = JavacFlowListener.instance(ctx);
-                            if (fl != null && fl.hasFlowCompleted(fo)) {
-                                if (LOGGER.isLoggable(Level.FINER)) {
-                                    final List<? extends Diagnostic> diag = ci.getDiagnostics();
-                                    if (!diag.isEmpty()) {
-                                        LOGGER.log(Level.FINER, "Reflow with errors: {0} {1}", new Object[]{fo, diag});     //NOI18N
-                                    }
-                                }
-                                TreePath tp = TreePath.getPath(cu, orig);       //todo: store treepath in changed method => improve speed
-                                Tree t = tp.getParentPath().getLeaf();
-                                pr.reflowMethodBody(cu, (ClassTree) t, orig);
-                                if (LOGGER.isLoggable(Level.FINER)) {
-                                    LOGGER.log(Level.FINER, "Reflowed method in: {0}", fo); //NOI18N
-                                }
-                            }
-                        }
-                        end = System.currentTimeMillis();
-                        if (fo != null) {
-                            logTime (fo, Phase.ELEMENTS_RESOLVED,0L);
-                            logTime (fo,Phase.RESOLVED,(end-start));
-                        }
-                    }
-
-                    //fix CompilationUnitTree.getLineMap:
-                    long startM = System.currentTimeMillis();
-                    char[] chars = snapshot.getText().toString().toCharArray();
-                    ((LineMapImpl) cu.getLineMap()).build(chars, chars.length, '\0');
-                    LOGGER.log(Level.FINER, "Rebuilding LineMap took: {0}", System.currentTimeMillis() - startM);
-
-                    ((CompilationInfoImpl.DiagnosticListenerImpl)dl).endPartialReparse (delta);
-                } finally {
-                    l.endPartialReparse();
-                    l.useSource(prevLogged);
-                }
-                ci.update(snapshot);
-            } finally {
-              if (treeLoader != null) {
-                  treeLoader.endPartialReparse();
-              }
-            }
-        } catch (CouplingAbort ca) {
-            //Needs full reparse
-            return false;
-        } catch (Throwable t) {
-            if (t instanceof ThreadDeath) {
-                throw (ThreadDeath) t;
-            }
-            boolean a = false;
-            assert a = true; 
-            if (a) {
-                dumpSource(ci, t);
-            }
-            return false;
-        }
-        return true;
+        return false;
+//        assert ci != null;
+//        final FileObject fo = ci.getFileObject();
+//        if (LOGGER.isLoggable(Level.FINER)) {
+//            LOGGER.log(Level.FINER, "Reparse method in: {0}", fo);          //NOI18N
+//        }
+//        if (((JCMethodDecl)orig).localEnv == null) {
+//            //We are seeing interface method or abstract or native method with body.
+//            //Don't do any optimalization of this broken code - has no attr env.
+//            return false;
+//        }
+//        final Phase currentPhase = ci.getPhase();
+//        if (Phase.PARSED.compareTo(currentPhase) > 0) {
+//            return false;
+//        }
+//        try {
+//            final CompilationUnitTree cu = ci.getCompilationUnit();
+//            if (cu == null || newBody == null) {
+//                return false;
+//            }
+//            final JavacTaskImpl task = ci.getJavacTask();
+//            PartialReparser pr = PartialReparser.instance(task.getContext());
+//            final JavacTrees jt = JavacTrees.instance(task);
+//            final int origStartPos = (int) jt.getSourcePositions().getStartPosition(cu, orig.getBody());
+//            final int origEndPos = (int) jt.getSourcePositions().getEndPosition(cu, orig.getBody());
+//            if (origStartPos > origEndPos) {
+//                LOGGER.log(Level.WARNING, "Javac returned startpos: {0} > endpos: {1}", new Object[]{origStartPos, origEndPos});  //NOI18N
+//                return false;
+//            }
+//            final FindAnonymousVisitor fav = new FindAnonymousVisitor();
+//            fav.scan(orig.getBody(), null);
+//            if (fav.hasLocalClass) {
+//                if (LOGGER.isLoggable(Level.FINER)) {
+//                    LOGGER.log(Level.FINER, "Skeep reparse method (old local classes): {0}", fo);   //NOI18N
+//                }
+//                return false;
+//            }
+//            final int firstInner = fav.firstInner;
+//            final int noInner = fav.noInner;
+//            final Context ctx = task.getContext();
+//            final TreeLoader treeLoader = TreeLoader.instance(ctx);
+//            if (treeLoader != null) {
+//                treeLoader.startPartialReparse();
+//            }
+//            try {
+//                final Log l = Log.instance(ctx);
+//                l.startPartialReparse();
+//                final JavaFileObject prevLogged = l.useSource(cu.getSourceFile());
+//                JCBlock block;
+//                try {
+//                    DiagnosticListener dl = ci.getDiagnosticListener();
+//                    assert dl instanceof CompilationInfoImpl.DiagnosticListenerImpl;
+//                    ((CompilationInfoImpl.DiagnosticListenerImpl)dl).startPartialReparse(origStartPos, origEndPos);
+//                    long start = System.currentTimeMillis();
+//                    Map<JCTree,String> docComments = new HashMap<JCTree, String>();
+//                    block = pr.reparseMethodBody(cu, orig, newBody, firstInner, docComments);
+//                    if (LOGGER.isLoggable(Level.FINER)) {
+//                        LOGGER.log(Level.FINER, "Reparsed method in: {0}", fo);     //NOI18N
+//                    }
+//                    assert block != null;
+//                    fav.reset();
+//                    fav.scan(block, null);
+//                    final int newNoInner = fav.noInner;
+//                    if (fav.hasLocalClass || noInner != newNoInner) {
+//                        if (LOGGER.isLoggable(Level.FINER)) {
+//                            LOGGER.log(Level.FINER, "Skeep reparse method (new local classes): {0}", fo);   //NOI18N
+//                        }
+//                        return false;
+//                    }
+//                    ((JCTree.JCCompilationUnit)cu).docComments.keySet().removeAll(fav.docOwners);
+//                    ((JCTree.JCCompilationUnit)cu).docComments.putAll(docComments);
+//                    long end = System.currentTimeMillis();
+//                    if (fo != null) {
+//                        logTime (fo,Phase.PARSED,(end-start));
+//                    }
+//                    final int newEndPos = (int) jt.getSourcePositions().getEndPosition(cu, block);
+//                    final int delta = newEndPos - origEndPos;
+//                    final Map<JCTree,Integer> endPos = ((JCCompilationUnit)cu).endPositions;
+//                    final TranslatePositionsVisitor tpv = new TranslatePositionsVisitor(orig, endPos, delta);
+//                    tpv.scan(cu, null);
+//                    ((JCMethodDecl)orig).body = block;
+//                    if (Phase.RESOLVED.compareTo(currentPhase)<=0) {
+//                        start = System.currentTimeMillis();
+//                        pr.reattrMethodBody(orig, block);
+//                        if (LOGGER.isLoggable(Level.FINER)) {
+//                            LOGGER.log(Level.FINER, "Resolved method in: {0}", fo);     //NOI18N
+//                        }
+//                        if (!((CompilationInfoImpl.DiagnosticListenerImpl)dl).hasPartialReparseErrors()) {
+//                            final JavacFlowListener fl = JavacFlowListener.instance(ctx);
+//                            if (fl != null && fl.hasFlowCompleted(fo)) {
+//                                if (LOGGER.isLoggable(Level.FINER)) {
+//                                    final List<? extends Diagnostic> diag = ci.getDiagnostics();
+//                                    if (!diag.isEmpty()) {
+//                                        LOGGER.log(Level.FINER, "Reflow with errors: {0} {1}", new Object[]{fo, diag});     //NOI18N
+//                                    }
+//                                }
+//                                TreePath tp = TreePath.getPath(cu, orig);       //todo: store treepath in changed method => improve speed
+//                                Tree t = tp.getParentPath().getLeaf();
+//                                pr.reflowMethodBody(cu, (ClassTree) t, orig);
+//                                if (LOGGER.isLoggable(Level.FINER)) {
+//                                    LOGGER.log(Level.FINER, "Reflowed method in: {0}", fo); //NOI18N
+//                                }
+//                            }
+//                        }
+//                        end = System.currentTimeMillis();
+//                        if (fo != null) {
+//                            logTime (fo, Phase.ELEMENTS_RESOLVED,0L);
+//                            logTime (fo,Phase.RESOLVED,(end-start));
+//                        }
+//                    }
+//
+//                    //fix CompilationUnitTree.getLineMap:
+//                    long startM = System.currentTimeMillis();
+//                    char[] chars = snapshot.getText().toString().toCharArray();
+//                    ((LineMapImpl) cu.getLineMap()).build(chars, chars.length, '\0');
+//                    LOGGER.log(Level.FINER, "Rebuilding LineMap took: {0}", System.currentTimeMillis() - startM);
+//
+//                    ((CompilationInfoImpl.DiagnosticListenerImpl)dl).endPartialReparse (delta);
+//                } finally {
+//                    l.endPartialReparse();
+//                    l.useSource(prevLogged);
+//                }
+//                ci.update(snapshot);
+//            } finally {
+//              if (treeLoader != null) {
+//                  treeLoader.endPartialReparse();
+//              }
+//            }
+//        } catch (CouplingAbort ca) {
+//            //Needs full reparse
+//            return false;
+//        } catch (Throwable t) {
+//            if (t instanceof ThreadDeath) {
+//                throw (ThreadDeath) t;
+//            }
+//            boolean a = false;
+//            assert a = true; 
+//            if (a) {
+//                dumpSource(ci, t);
+//            }
+//            return false;
+//        }
+//        return true;
     }
 
     //Helper classes
diff --git a/java.source/src/org/netbeans/modules/java/source/pretty/VeryPretty.java b/java.source/src/org/netbeans/modules/java/source/pretty/VeryPretty.java
--- a/java.source/src/org/netbeans/modules/java/source/pretty/VeryPretty.java
+++ b/java.source/src/org/netbeans/modules/java/source/pretty/VeryPretty.java
@@ -582,7 +582,7 @@
         printPackage(tree.pid);
         List<JCTree> l = tree.defs;
         ArrayList<JCImport> imports = new ArrayList<JCImport>();
-        while (l.nonEmpty() && l.head.getTag() == JCTree.IMPORT){
+        while (l.nonEmpty() && l.head.getTag() == JCTree.Tag.IMPORT){
             imports.add((JCImport) l.head);
             l = l.tail;
         }
@@ -912,7 +912,7 @@
             print(' ');
         int col = out.col;
 	if (tree.init.nonEmpty()) {
-	    if (tree.init.head.getTag() == JCTree.VARDEF) {
+	    if (tree.init.head.getTag() == JCTree.Tag.VARDEF) {
 		printNoParenExpr(tree.init.head);
 		for (List<? extends JCTree> l = tree.init.tail; l.nonEmpty(); l = l.tail) {
 		    JCVariableDecl vdef = (JCVariableDecl) l.head;
@@ -1251,11 +1251,11 @@
     }
 
     public void printMethodSelect(JCMethodInvocation tree) {
-        if (tree.meth.getTag() == JCTree.SELECT) {
+        if (tree.meth.getTag() == JCTree.Tag.SELECT) {
             JCFieldAccess left = (JCFieldAccess)tree.meth;
             printExpr(left.selected);
             print('.');
-            if (left.selected.getTag() == JCTree.APPLY) {
+            if (left.selected.getTag() == JCTree.Tag.APPLY) {
                 switch(cs.wrapChainedMethodCalls()) {
                 case WRAP_IF_LONG:
                     int rm = cs.getRightMargin();
@@ -1322,7 +1322,7 @@
 	    print("new ");
 	    int n = tree.elems != null ? 1 : 0;
 	    JCTree elemtype = tree.elemtype;
-	    while (elemtype.getTag() == JCTree.TYPEARRAY) {
+	    while (elemtype.getTag() == JCTree.Tag.TYPEARRAY) {
 		n++;
 		elemtype = ((JCArrayTypeTree) elemtype).elemtype;
 	    }
@@ -1390,7 +1390,7 @@
 	printExpr(tree.lhs, TreeInfo.assignopPrec + 1);
 	if (cs.spaceAroundAssignOps())
             print(' ');
-	print(treeinfo.operatorName(tree.getTag() - JCTree.ASGOffset));
+	print(treeinfo.operatorName(tree.getTag()));
         print('=');
 	int rm = cs.getRightMargin();
         switch(cs.wrapAssignOps()) {
@@ -1416,15 +1416,15 @@
     public void visitUnary(JCUnary tree) {
 	int ownprec = TreeInfo.opPrec(tree.getTag());
 	Name opname = treeinfo.operatorName(tree.getTag());
-	if (tree.getTag() <= JCTree.PREDEC) {
+	if (tree.getTag().operatorIndex() <= JCTree.Tag.PREDEC.operatorIndex()) {
             if (cs.spaceAroundUnaryOps()) {
                 needSpace();
                 print(opname);
                 print(' ');
             } else {
                 print(opname);
-                if (   (tree.getTag() == JCTree.POS && (tree.arg.getTag() == JCTree.POS || tree.arg.getTag() == JCTree.PREINC))
-                    || (tree.getTag() == JCTree.NEG && (tree.arg.getTag() == JCTree.NEG || tree.arg.getTag() == JCTree.PREDEC))) {
+                if (   (tree.getKind() == Kind.PLUS  && (tree.arg.getKind() == Kind.UNARY_PLUS || tree.arg.getKind() == Kind.PREFIX_INCREMENT))
+                    || (tree.getKind() == Kind.MINUS && (tree.arg.getKind() == Kind.UNARY_MINUS || tree.arg.getKind() == Kind.PREFIX_DECREMENT))) {
                     print(' ');
                 }
             }
@@ -1451,8 +1451,8 @@
             print(' ');
 	print(opname);
         boolean needsSpace =    cs.spaceAroundBinaryOps()
-                             || (tree.getTag() == JCTree.PLUS  && (tree.rhs.getTag() == JCTree.POS || tree.rhs.getTag() == JCTree.PREINC))
-                             || (tree.getTag() == JCTree.MINUS && (tree.rhs.getTag() == JCTree.NEG || tree.rhs.getTag() == JCTree.PREDEC));
+                             || (tree.getKind() == Kind.PLUS  && (tree.rhs.getKind() == Kind.UNARY_PLUS || tree.rhs.getKind() == Kind.PREFIX_INCREMENT))
+                             || (tree.getKind() == Kind.MINUS && (tree.rhs.getKind() == Kind.UNARY_MINUS || tree.rhs.getKind() == Kind.PREFIX_DECREMENT));
 	int rm = cs.getRightMargin();
         switch(cs.wrapBinaryOps()) {
         case WRAP_IF_LONG:
@@ -2019,8 +2019,8 @@
                 blankLines(tree, true);
 	    printPrecedingComments(tree, !member);
             printExpr(tree, TreeInfo.notExpression);
-	    int tag = tree.getTag();
-	    if(JCTree.APPLY<=tag && tag<=JCTree.MOD_ASG) print(';');
+	    int tag = tree.getTag().operatorIndex();
+	    if(JCTree.Tag.APPLY.operatorIndex()<=tag && tag<=JCTree.Tag.MOD_ASG.operatorIndex()) print(';');
             printTrailingComments(tree, !member);
             blankLines(tree, false);
 	}
@@ -2411,10 +2411,10 @@
     }
 
     public Name fullName(JCTree tree) {
-	switch (tree.getTag()) {
-	case JCTree.IDENT:
+	switch (tree.getKind()) {
+	case IDENTIFIER:
 	    return ((JCIdent) tree).name;
-	case JCTree.SELECT:
+	case MEMBER_SELECT:
             JCFieldAccess sel = (JCFieldAccess)tree;
 	    Name sname = fullName(sel.selected);
 	    return sname != null && sname.getByteLength() > 0 ? sname.append('.', sel.name) : sel.name;
@@ -2447,7 +2447,7 @@
 
     /** Is the given tree an enumerator definition? */
     private static boolean isEnumerator(JCTree tree) {
-        return tree.getTag() == JCTree.VARDEF && (((JCVariableDecl) tree).mods.flags & ENUM) != 0;
+        return tree.getKind() == Kind.VARIABLE && (((JCVariableDecl) tree).mods.flags & ENUM) != 0;
     }
 
     private String replace(String a,String b) {
diff --git a/java.source/src/org/netbeans/modules/java/source/pretty/WidthEstimator.java b/java.source/src/org/netbeans/modules/java/source/pretty/WidthEstimator.java
--- a/java.source/src/org/netbeans/modules/java/source/pretty/WidthEstimator.java
+++ b/java.source/src/org/netbeans/modules/java/source/pretty/WidthEstimator.java
@@ -175,7 +175,7 @@
 	if (tree.elemtype != null) {
 	    width+=4;
 	    JCTree elemtype = tree.elemtype;
-	    while (elemtype.getTag() == JCTree.TYPEARRAY) {
+	    while (elemtype.getTag() == JCTree.Tag.TYPEARRAY) {
 		width+=2;
 		elemtype = ((JCArrayTypeTree) elemtype).elemtype;
 	    }
@@ -232,7 +232,7 @@
     public void visitAssignop(JCAssignOp tree) {
 	open(prec, TreeInfo.assignopPrec);
 	width+=3;
-	width(treeinfo.operatorName(tree.getTag() - JCTree.ASGOffset));
+	width(treeinfo.operatorName(tree.getTag()));
 	width(tree.lhs, TreeInfo.assignopPrec + 1);
 	width(tree.rhs, TreeInfo.assignopPrec);
     }
diff --git a/java.source/src/org/netbeans/modules/java/source/save/CasualDiff.java b/java.source/src/org/netbeans/modules/java/source/save/CasualDiff.java
--- a/java.source/src/org/netbeans/modules/java/source/save/CasualDiff.java
+++ b/java.source/src/org/netbeans/modules/java/source/save/CasualDiff.java
@@ -1591,7 +1591,7 @@
         return bounds[1];
     }
 
-    private String operatorName(int tag) {
+    private String operatorName(Tag tag) {
         // dummy instance, just to access a public method which should be static
         return new Pretty(null, false).operatorName(tag);
     }
@@ -1982,139 +1982,139 @@
 
         // don't use visitor, since we want fast-fail behavior
         switch (t1.getTag()) {
-          case JCTree.TOPLEVEL:
+          case TOPLEVEL:
               return ((JCCompilationUnit)t1).sourcefile.equals(((JCCompilationUnit)t2).sourcefile);
-          case JCTree.IMPORT:
+          case IMPORT:
               return matchImport((JCImport)t1, (JCImport)t2);
-          case JCTree.CLASSDEF:
+          case CLASSDEF:
               return ((JCClassDecl)t1).sym == ((JCClassDecl)t2).sym;
-          case JCTree.METHODDEF:
+          case METHODDEF:
               return ((JCMethodDecl)t1).sym == ((JCMethodDecl)t2).sym;
-          case JCTree.VARDEF:
+          case VARDEF:
               return ((JCVariableDecl)t1).sym == ((JCVariableDecl)t2).sym;
-          case JCTree.SKIP:
+          case SKIP:
               return true;
-          case JCTree.BLOCK:
+          case BLOCK:
               return matchBlock((JCBlock)t1, (JCBlock)t2);
-          case JCTree.DOLOOP:
+          case DOLOOP:
               return matchDoLoop((JCDoWhileLoop)t1, (JCDoWhileLoop)t2);
-          case JCTree.WHILELOOP:
+          case WHILELOOP:
               return matchWhileLoop((JCWhileLoop)t1, (JCWhileLoop)t2);
-          case JCTree.FORLOOP:
+          case FORLOOP:
               return matchForLoop((JCForLoop)t1, (JCForLoop)t2);
-          case JCTree.FOREACHLOOP:
+          case FOREACHLOOP:
               return matchForeachLoop((JCEnhancedForLoop)t1, (JCEnhancedForLoop)t2);
-          case JCTree.LABELLED:
+          case LABELLED:
               return matchLabelled((JCLabeledStatement)t1, (JCLabeledStatement)t2);
-          case JCTree.SWITCH:
+          case SWITCH:
               return matchSwitch((JCSwitch)t1, (JCSwitch)t2);
-          case JCTree.CASE:
+          case CASE:
               return matchCase((JCCase)t1, (JCCase)t2);
-          case JCTree.SYNCHRONIZED:
+          case SYNCHRONIZED:
               return matchSynchronized((JCSynchronized)t1, (JCSynchronized)t2);
-          case JCTree.TRY:
+          case TRY:
               return matchTry((JCTry)t1, (JCTry)t2);
-          case JCTree.CATCH:
+          case CATCH:
               return matchCatch((JCCatch)t1, (JCCatch)t2);
-          case JCTree.CONDEXPR:
+          case CONDEXPR:
               return matchConditional((JCConditional)t1, (JCConditional)t2);
-          case JCTree.IF:
+          case IF:
               return matchIf((JCIf)t1, (JCIf)t2);
-          case JCTree.EXEC:
+          case EXEC:
               return treesMatch(((JCExpressionStatement)t1).expr, ((JCExpressionStatement)t2).expr);
-          case JCTree.BREAK:
+          case BREAK:
               return matchBreak((JCBreak)t1, (JCBreak)t2);
-          case JCTree.CONTINUE:
+          case CONTINUE:
               return matchContinue((JCContinue)t1, (JCContinue)t2);
-          case JCTree.RETURN:
+          case RETURN:
               return treesMatch(((JCReturn)t1).expr, ((JCReturn)t2).expr);
-          case JCTree.THROW:
+          case THROW:
               return treesMatch(((JCThrow)t1).expr, ((JCThrow)t2).expr);
-          case JCTree.ASSERT:
+          case ASSERT:
               return matchAssert((JCAssert)t1, (JCAssert)t2);
-          case JCTree.APPLY:
+          case APPLY:
               return matchApply((JCMethodInvocation)t1, (JCMethodInvocation)t2);
-          case JCTree.NEWCLASS:
+          case NEWCLASS:
               // #97501: workaround. Not sure about comparing symbols and their
               // copying in ImmutableTreeTranslator, making workaround with
               // minimal impact - issue has to be fixed correctly in the future.
               if (((JCNewClass)t2).def != null) ((JCNewClass)t2).def.sym = null;
               return matchNewClass((JCNewClass)t1, (JCNewClass)t2);
-          case JCTree.NEWARRAY:
+          case NEWARRAY:
               return matchNewArray((JCNewArray)t1, (JCNewArray)t2);
-          case JCTree.PARENS:
+          case PARENS:
               return treesMatch(((JCParens)t1).expr, ((JCParens)t2).expr);
-          case JCTree.ASSIGN:
+          case ASSIGN:
               return matchAssign((JCAssign)t1, (JCAssign)t2);
-          case JCTree.TYPECAST:
+          case TYPECAST:
               return matchTypeCast((JCTypeCast)t1, (JCTypeCast)t2);
-          case JCTree.TYPETEST:
+          case TYPETEST:
               return matchTypeTest((JCInstanceOf)t1, (JCInstanceOf)t2);
-          case JCTree.INDEXED:
+          case INDEXED:
               return matchIndexed((JCArrayAccess)t1, (JCArrayAccess)t2);
-          case JCTree.SELECT:
+          case SELECT:
               return matchSelect((JCFieldAccess) t1, (JCFieldAccess) t2);
-          case JCTree.IDENT:
+          case IDENT:
               return ((JCIdent)t1).getName().contentEquals(((JCIdent)t2).getName());
-          case JCTree.LITERAL:
+          case LITERAL:
               return matchLiteral((JCLiteral)t1, (JCLiteral)t2);
-          case JCTree.TYPEIDENT:
+          case TYPEIDENT:
               return ((JCPrimitiveTypeTree)t1).typetag == ((JCPrimitiveTypeTree)t2).typetag;
-          case JCTree.TYPEARRAY:
+          case TYPEARRAY:
               return treesMatch(((JCArrayTypeTree)t1).elemtype, ((JCArrayTypeTree)t2).elemtype);
-          case JCTree.TYPEAPPLY:
+          case TYPEAPPLY:
               return matchTypeApply((JCTypeApply)t1, (JCTypeApply)t2);
-          case JCTree.TYPEPARAMETER:
+          case TYPEPARAMETER:
               return matchTypeParameter((JCTypeParameter)t1, (JCTypeParameter)t2);
-          case JCTree.WILDCARD:
+          case WILDCARD:
               return matchWildcard((JCWildcard)t1, (JCWildcard)t2);
-          case JCTree.TYPEBOUNDKIND:
+          case TYPEBOUNDKIND:
               return ((TypeBoundKind)t1).kind == ((TypeBoundKind)t2).kind;
-          case JCTree.ANNOTATION:
+          case ANNOTATION:
               return matchAnnotation((JCAnnotation)t1, (JCAnnotation)t2);
-          case JCTree.LETEXPR:
+          case LETEXPR:
               return matchLetExpr((LetExpr)t1, (LetExpr)t2);
-          case JCTree.POS:
-          case JCTree.NEG:
-          case JCTree.NOT:
-          case JCTree.COMPL:
-          case JCTree.PREINC:
-          case JCTree.PREDEC:
-          case JCTree.POSTINC:
-          case JCTree.POSTDEC:
-          case JCTree.NULLCHK:
+          case POS:
+          case NEG:
+          case NOT:
+          case COMPL:
+          case PREINC:
+          case PREDEC:
+          case POSTINC:
+          case POSTDEC:
+          case NULLCHK:
               return matchUnary((JCUnary)t1, (JCUnary)t2);
-          case JCTree.OR:
-          case JCTree.AND:
-          case JCTree.BITOR:
-          case JCTree.BITXOR:
-          case JCTree.BITAND:
-          case JCTree.EQ:
-          case JCTree.NE:
-          case JCTree.LT:
-          case JCTree.GT:
-          case JCTree.LE:
-          case JCTree.GE:
-          case JCTree.SL:
-          case JCTree.SR:
-          case JCTree.USR:
-          case JCTree.PLUS:
-          case JCTree.MINUS:
-          case JCTree.MUL:
-          case JCTree.DIV:
-          case JCTree.MOD:
+          case OR:
+          case AND:
+          case BITOR:
+          case BITXOR:
+          case BITAND:
+          case EQ:
+          case NE:
+          case LT:
+          case GT:
+          case LE:
+          case GE:
+          case SL:
+          case SR:
+          case USR:
+          case PLUS:
+          case MINUS:
+          case MUL:
+          case DIV:
+          case MOD:
               return matchBinary((JCBinary)t1, (JCBinary)t2);
-          case JCTree.BITOR_ASG:
-          case JCTree.BITXOR_ASG:
-          case JCTree.BITAND_ASG:
-          case JCTree.SL_ASG:
-          case JCTree.SR_ASG:
-          case JCTree.USR_ASG:
-          case JCTree.PLUS_ASG:
-          case JCTree.MINUS_ASG:
-          case JCTree.MUL_ASG:
-          case JCTree.DIV_ASG:
-          case JCTree.MOD_ASG:
+          case BITOR_ASG:
+          case BITXOR_ASG:
+          case BITAND_ASG:
+          case SL_ASG:
+          case SR_ASG:
+          case USR_ASG:
+          case PLUS_ASG:
+          case MINUS_ASG:
+          case MUL_ASG:
+          case DIV_ASG:
+          case MOD_ASG:
               return matchAssignop((JCAssignOp)t1, (JCAssignOp)t2);
           default:
               String msg = ((com.sun.source.tree.Tree)t1).getKind().toString() +
@@ -3216,192 +3216,192 @@
         }
 
         switch (oldT.getTag()) {
-          case JCTree.TOPLEVEL:
+          case TOPLEVEL:
               diffTopLevel((JCCompilationUnit)oldT, (JCCompilationUnit)newT);
               break;
-          case JCTree.IMPORT:
+          case IMPORT:
               retVal = diffImport((JCImport)oldT, (JCImport)newT, elementBounds);
               break;
-          case JCTree.CLASSDEF:
+          case CLASSDEF:
               retVal = diffClassDef((JCClassDecl)oldT, (JCClassDecl)newT, elementBounds);
               break;
-          case JCTree.METHODDEF:
+          case METHODDEF:
               retVal = diffMethodDef((JCMethodDecl)oldT, (JCMethodDecl)newT, elementBounds);
               break;
-          case JCTree.VARDEF:
+          case VARDEF:
               retVal = diffVarDef((JCVariableDecl)oldT, (JCVariableDecl)newT, elementBounds);
               break;
-          case JCTree.SKIP:
+          case SKIP:
               copyTo(elementBounds[0], elementBounds[1]);
               retVal = elementBounds[1];
               break;
-          case JCTree.BLOCK:
+          case BLOCK:
               retVal = diffBlock((JCBlock)oldT, (JCBlock)newT, elementBounds);
               break;
-          case JCTree.DOLOOP:
+          case DOLOOP:
               retVal = diffDoLoop((JCDoWhileLoop)oldT, (JCDoWhileLoop)newT, elementBounds);
               break;
-          case JCTree.WHILELOOP:
+          case WHILELOOP:
               retVal = diffWhileLoop((JCWhileLoop)oldT, (JCWhileLoop)newT, elementBounds);
               break;
-          case JCTree.FORLOOP:
+          case FORLOOP:
               retVal = diffForLoop((JCForLoop)oldT, (JCForLoop)newT, elementBounds);
               break;
-          case JCTree.FOREACHLOOP:
+          case FOREACHLOOP:
               retVal = diffForeachLoop((JCEnhancedForLoop)oldT, (JCEnhancedForLoop)newT, elementBounds);
               break;
-          case JCTree.LABELLED:
+          case LABELLED:
               retVal = diffLabelled((JCLabeledStatement)oldT, (JCLabeledStatement)newT, elementBounds);
               break;
-          case JCTree.SWITCH:
+          case SWITCH:
               retVal = diffSwitch((JCSwitch)oldT, (JCSwitch)newT, elementBounds);
               break;
-          case JCTree.CASE:
+          case CASE:
               retVal = diffCase((JCCase)oldT, (JCCase)newT, elementBounds);
               break;
-          case JCTree.SYNCHRONIZED:
+          case SYNCHRONIZED:
               retVal = diffSynchronized((JCSynchronized)oldT, (JCSynchronized)newT, elementBounds);
               break;
-          case JCTree.TRY:
+          case TRY:
               retVal = diffTry((JCTry)oldT, (JCTry)newT, elementBounds);
               break;
-          case JCTree.CATCH:
+          case CATCH:
               retVal = diffCatch((JCCatch)oldT, (JCCatch)newT, elementBounds);
               break;
-          case JCTree.CONDEXPR:
+          case CONDEXPR:
               retVal = diffConditional((JCConditional)oldT, (JCConditional)newT, elementBounds);
               break;
-          case JCTree.IF:
+          case IF:
               retVal = diffIf((JCIf)oldT, (JCIf)newT, elementBounds);
               break;
-          case JCTree.EXEC:
+          case EXEC:
               retVal = diffExec((JCExpressionStatement)oldT, (JCExpressionStatement)newT, elementBounds);
               break;
-          case JCTree.BREAK:
+          case BREAK:
               retVal = diffBreak((JCBreak)oldT, (JCBreak)newT, elementBounds);
               break;
-          case JCTree.CONTINUE:
+          case CONTINUE:
               retVal = diffContinue((JCContinue)oldT, (JCContinue)newT, elementBounds);
               break;
-          case JCTree.RETURN:
+          case RETURN:
               retVal = diffReturn((JCReturn)oldT, (JCReturn)newT, elementBounds);
               break;
-          case JCTree.THROW:
+          case THROW:
               retVal = diffThrow((JCThrow)oldT, (JCThrow)newT,elementBounds);
               break;
-          case JCTree.ASSERT:
+          case ASSERT:
               retVal = diffAssert((JCAssert)oldT, (JCAssert)newT, elementBounds);
               break;
-          case JCTree.APPLY:
+          case APPLY:
               retVal = diffApply((JCMethodInvocation)oldT, (JCMethodInvocation)newT, elementBounds);
               break;
-          case JCTree.NEWCLASS:
+          case NEWCLASS:
               retVal = diffNewClass((JCNewClass)oldT, (JCNewClass)newT, elementBounds);
               break;
-          case JCTree.NEWARRAY:
+          case NEWARRAY:
               retVal = diffNewArray((JCNewArray)oldT, (JCNewArray)newT, elementBounds);
               break;
-          case JCTree.PARENS:
+          case PARENS:
               retVal = diffParens((JCParens)oldT, (JCParens)newT, elementBounds);
               break;
-          case JCTree.ASSIGN:
+          case ASSIGN:
               retVal = diffAssign((JCAssign)oldT, (JCAssign)newT, parent, elementBounds);
               break;
-          case JCTree.TYPECAST:
+          case TYPECAST:
               retVal = diffTypeCast((JCTypeCast)oldT, (JCTypeCast)newT, elementBounds);
               break;
-          case JCTree.TYPETEST:
+          case TYPETEST:
               retVal = diffTypeTest((JCInstanceOf)oldT, (JCInstanceOf)newT, elementBounds);
               break;
-          case JCTree.INDEXED:
+          case INDEXED:
               retVal = diffIndexed((JCArrayAccess)oldT, (JCArrayAccess)newT, elementBounds);
               break;
-          case JCTree.SELECT:
+          case SELECT:
               retVal = diffSelect((JCFieldAccess)oldT, (JCFieldAccess)newT, elementBounds);
               break;
-          case JCTree.IDENT:
+          case IDENT:
               retVal = diffIdent((JCIdent)oldT, (JCIdent)newT, elementBounds);
               break;
-          case JCTree.LITERAL:
+          case LITERAL:
               retVal = diffLiteral((JCLiteral)oldT, (JCLiteral)newT, elementBounds);
               break;
-          case JCTree.TYPEIDENT:
+          case TYPEIDENT:
               retVal = diffTypeIdent((JCPrimitiveTypeTree)oldT, (JCPrimitiveTypeTree)newT, elementBounds);
               break;
-          case JCTree.TYPEARRAY:
+          case TYPEARRAY:
               retVal = diffTypeArray((JCArrayTypeTree)oldT, (JCArrayTypeTree)newT, elementBounds);
               break;
-          case JCTree.TYPEAPPLY:
+          case TYPEAPPLY:
               retVal = diffTypeApply((JCTypeApply)oldT, (JCTypeApply)newT, elementBounds);
               break;
-          case JCTree.TYPEPARAMETER:
+          case TYPEPARAMETER:
               retVal = diffTypeParameter((JCTypeParameter)oldT, (JCTypeParameter)newT, elementBounds);
               break;
-          case JCTree.WILDCARD:
+          case WILDCARD:
               retVal = diffWildcard((JCWildcard)oldT, (JCWildcard)newT, elementBounds);
               break;
-          case JCTree.TYPEBOUNDKIND:
+          case TYPEBOUNDKIND:
               retVal = diffTypeBoundKind((TypeBoundKind)oldT, (TypeBoundKind)newT, elementBounds);
               break;
-          case JCTree.ANNOTATION:
+          case ANNOTATION:
               retVal = diffAnnotation((JCAnnotation)oldT, (JCAnnotation)newT, elementBounds);
               break;
-          case JCTree.LETEXPR:
+          case LETEXPR:
               diffLetExpr((LetExpr)oldT, (LetExpr)newT);
               break;
-          case JCTree.POS:
-          case JCTree.NEG:
-          case JCTree.NOT:
-          case JCTree.COMPL:
-          case JCTree.PREINC:
-          case JCTree.PREDEC:
-          case JCTree.POSTINC:
-          case JCTree.POSTDEC:
-          case JCTree.NULLCHK:
+          case POS:
+          case NEG:
+          case NOT:
+          case COMPL:
+          case PREINC:
+          case PREDEC:
+          case POSTINC:
+          case POSTDEC:
+          case NULLCHK:
               retVal = diffUnary((JCUnary)oldT, (JCUnary)newT, elementBounds);
               break;
-          case JCTree.OR:
-          case JCTree.AND:
-          case JCTree.BITOR:
-          case JCTree.BITXOR:
-          case JCTree.BITAND:
-          case JCTree.EQ:
-          case JCTree.NE:
-          case JCTree.LT:
-          case JCTree.GT:
-          case JCTree.LE:
-          case JCTree.GE:
-          case JCTree.SL:
-          case JCTree.SR:
-          case JCTree.USR:
-          case JCTree.PLUS:
-          case JCTree.MINUS:
-          case JCTree.MUL:
-          case JCTree.DIV:
-          case JCTree.MOD:
+          case OR:
+          case AND:
+          case BITOR:
+          case BITXOR:
+          case BITAND:
+          case EQ:
+          case NE:
+          case LT:
+          case GT:
+          case LE:
+          case GE:
+          case SL:
+          case SR:
+          case USR:
+          case PLUS:
+          case MINUS:
+          case MUL:
+          case DIV:
+          case MOD:
               retVal = diffBinary((JCBinary)oldT, (JCBinary)newT, elementBounds);
               break;
-          case JCTree.BITOR_ASG:
-          case JCTree.BITXOR_ASG:
-          case JCTree.BITAND_ASG:
-          case JCTree.SL_ASG:
-          case JCTree.SR_ASG:
-          case JCTree.USR_ASG:
-          case JCTree.PLUS_ASG:
-          case JCTree.MINUS_ASG:
-          case JCTree.MUL_ASG:
-          case JCTree.DIV_ASG:
-          case JCTree.MOD_ASG:
+          case BITOR_ASG:
+          case BITXOR_ASG:
+          case BITAND_ASG:
+          case SL_ASG:
+          case SR_ASG:
+          case USR_ASG:
+          case PLUS_ASG:
+          case MINUS_ASG:
+          case MUL_ASG:
+          case DIV_ASG:
+          case MOD_ASG:
               retVal = diffAssignop((JCAssignOp)oldT, (JCAssignOp)newT, elementBounds);
               break;
-          case JCTree.ERRONEOUS:
+          case ERRONEOUS:
               diffErroneous((JCErroneous)oldT, (JCErroneous)newT, elementBounds);
               break;
-          case JCTree.MODIFIERS:
+          case MODIFIERS:
               retVal = diffModifiers((JCModifiers) oldT, (JCModifiers) newT, parent, elementBounds[0]);
               copyTo(retVal, elementBounds[1]);
               break;
-          case JCTree.TYPEUNION:
+          case TYPEUNION:
               retVal = diffUnionType((JCTypeUnion) oldT, (JCTypeUnion) newT, elementBounds);
               break;
           default:
diff --git a/java.source/src/org/netbeans/modules/java/source/save/Reindenter.java b/java.source/src/org/netbeans/modules/java/source/save/Reindenter.java
--- a/java.source/src/org/netbeans/modules/java/source/save/Reindenter.java
+++ b/java.source/src/org/netbeans/modules/java/source/save/Reindenter.java
@@ -64,6 +64,7 @@
 import com.sun.source.util.SourcePositions;
 import com.sun.source.util.TreeScanner;
 import com.sun.tools.javac.api.JavacTaskImpl;
+import com.sun.tools.javac.api.JavacTool;
 import com.sun.tools.javac.api.JavacTrees;
 import com.sun.tools.javac.main.JavaCompiler;
 
@@ -129,7 +130,7 @@
         ClassLoader origCL = Thread.currentThread().getContextClassLoader();
         try {
             Thread.currentThread().setContextClassLoader(Reindenter.class.getClassLoader());
-            JavacTaskImpl javacTask = (JavacTaskImpl)ToolProvider.getSystemJavaCompiler().getTask(null, null, new DiagnosticListener<JavaFileObject>() {
+            JavacTaskImpl javacTask = (JavacTaskImpl) new JavacTool().getTask(null, null, new DiagnosticListener<JavaFileObject>() {
                 @Override
                 public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
                 }
diff --git a/java.source/src/org/netbeans/modules/java/source/transform/FieldGroupTree.java b/java.source/src/org/netbeans/modules/java/source/transform/FieldGroupTree.java
--- a/java.source/src/org/netbeans/modules/java/source/transform/FieldGroupTree.java
+++ b/java.source/src/org/netbeans/modules/java/source/transform/FieldGroupTree.java
@@ -105,7 +105,7 @@
         return vars.hashCode();
     }
 
-    public int getTag() {
-        return 0;
+    public Tag getTag() {
+        return Tag.NO_TAG;
     }
 }
diff --git a/java.source/src/org/netbeans/modules/java/source/transform/ImmutableTreeTranslator.java b/java.source/src/org/netbeans/modules/java/source/transform/ImmutableTreeTranslator.java
--- a/java.source/src/org/netbeans/modules/java/source/transform/ImmutableTreeTranslator.java
+++ b/java.source/src/org/netbeans/modules/java/source/transform/ImmutableTreeTranslator.java
@@ -1200,5 +1200,15 @@
 	return tree;
     }
 
+    @Override
+    public Tree visitLambdaExpression(LambdaExpressionTree node, Object p) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Tree visitMemberReference(MemberReferenceTree node, Object p) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
 
 }
diff --git a/lib.nbjavac/src/com/sun/tools/javac/api/ClassNamesForFileOraculum.java b/lib.nbjavac/src/com/sun/tools/javac/api/ClassNamesForFileOraculum.java
new file mode 100644
--- /dev/null
+++ b/lib.nbjavac/src/com/sun/tools/javac/api/ClassNamesForFileOraculum.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.tools.javac.api;
+
+import javax.tools.JavaFileObject;
+
+/**
+ * <p><b>This is NOT part of any API supported by Sun Microsystems.
+ * If you write code that depends on this, you do so at your own
+ * risk.  This code and its internal interfaces are subject to change
+ * or deletion without notice.</b></p>
+ * 
+ * @author Jan Lahoda
+ */
+public interface ClassNamesForFileOraculum {
+
+    public String[] divineClassName(JavaFileObject jfo);
+
+    public JavaFileObject[] divineSources(String fqn);
+}
diff --git a/lib.nbjavac/src/com/sun/tools/javac/api/DuplicateClassChecker.java b/lib.nbjavac/src/com/sun/tools/javac/api/DuplicateClassChecker.java
new file mode 100644
--- /dev/null
+++ b/lib.nbjavac/src/com/sun/tools/javac/api/DuplicateClassChecker.java
@@ -0,0 +1,36 @@
+/* Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+package com.sun.tools.javac.api;
+
+import javax.lang.model.element.Name;
+import javax.tools.JavaFileObject;
+
+/**
+ *
+ * @author Dusan Balek
+ */
+public interface DuplicateClassChecker {
+
+    boolean check(Name name, JavaFileObject jfo);
+}
diff --git a/lib.nbjavac/src/com/sun/tools/javac/model/LazyTreeLoader.java b/lib.nbjavac/src/com/sun/tools/javac/model/LazyTreeLoader.java
new file mode 100644
--- /dev/null
+++ b/lib.nbjavac/src/com/sun/tools/javac/model/LazyTreeLoader.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2003-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.tools.javac.model;
+
+import com.sun.source.tree.Tree;
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.CouplingAbort;
+
+/**
+ *
+ * @author Dusan Balek
+ */
+public class LazyTreeLoader {
+
+    /** The context key for the parameter name resolver. */
+    public static final Context.Key<LazyTreeLoader> lazyTreeLoaderKey =
+        new Context.Key<LazyTreeLoader>();
+
+    public static LazyTreeLoader instance(Context context) {
+        LazyTreeLoader instance = context.get(lazyTreeLoaderKey);
+        if (instance == null) {
+            instance = new LazyTreeLoader();
+            context.put(lazyTreeLoaderKey, instance);
+        }
+        return instance;
+    }
+
+    public boolean loadTreeFor(ClassSymbol clazz, boolean persist) {
+        return false;
+    }
+
+    public boolean loadParamNames(ClassSymbol clazz) {
+        return false;
+    }
+
+    public void couplingError(ClassSymbol clazz, Tree t) {
+        throw new CouplingAbort(clazz, t);
+    }
+
+    public void updateContext(Context context) {
+    }
+}
diff --git a/lib.nbjavac/src/com/sun/tools/javac/util/CouplingAbort.java b/lib.nbjavac/src/com/sun/tools/javac/util/CouplingAbort.java
new file mode 100644
--- /dev/null
+++ b/lib.nbjavac/src/com/sun/tools/javac/util/CouplingAbort.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2003-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.tools.javac.util;
+
+import com.sun.source.tree.Tree;
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import javax.tools.JavaFileObject;
+
+/**
+ *
+ * @author jlahoda
+ */
+public class CouplingAbort extends Abort {
+
+    private JavaFileObject classFile;
+    private JavaFileObject sourceFile;
+    private Tree t;
+
+    /** Creates a new instance of CouplingAbort */
+    public CouplingAbort(ClassSymbol clazz, Tree t) {
+        this.classFile = clazz != null ? clazz.classfile : null;
+        this.sourceFile = clazz != null ? clazz.sourcefile : null;
+        this.t = t;
+
+        wasCouplingError = true;
+    }
+
+    public JavaFileObject getClassFile() {
+        return classFile;
+    }
+
+    public JavaFileObject getSourceFile() {
+        return sourceFile;
+    }
+
+    public Tree getTree() {
+        return t;
+    }
+
+    public static boolean wasCouplingError;
+
+}
diff --git a/lib.nbjavac/src/com/sun/tools/javac/util/MemoryLowAbort.java b/lib.nbjavac/src/com/sun/tools/javac/util/MemoryLowAbort.java
new file mode 100644
--- /dev/null
+++ b/lib.nbjavac/src/com/sun/tools/javac/util/MemoryLowAbort.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2003-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.tools.javac.util;
+
+/**
+ *
+ * @author Dusan Balek
+ */
+public final class MemoryLowAbort extends Abort {
+
+    MemoryLowAbort() {
+    }
+}
diff --git a/lib.nbjavac/src/com/sun/tools/javac/util/MissingPlatformError.java b/lib.nbjavac/src/com/sun/tools/javac/util/MissingPlatformError.java
new file mode 100644
--- /dev/null
+++ b/lib.nbjavac/src/com/sun/tools/javac/util/MissingPlatformError.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.tools.javac.util;
+
+/**
+ *
+ * @author Tomas Zezula
+ */
+public class MissingPlatformError extends FatalError {
+    
+    private final JCDiagnostic diagnostic;
+    
+    /** Construct a <code>FatalError</code> with no detail message.
+     */
+    public MissingPlatformError() {
+        this("A Java Platform is Missing");
+    }
+
+    /** Construct a <code>FatalError</code> with the specified detail message.
+     *  @param d A diagnostic containing the reason for failure.
+     */
+    public MissingPlatformError(JCDiagnostic d) {
+        super(d);
+        this.diagnostic = d;
+    }
+
+    /** Construct a <code>FatalError</code> with the specified detail message.
+     *  @param s An English(!) string describing the failure, typically because
+     *           the diagnostic resources are missing.
+     */
+    public MissingPlatformError(String s) {
+        super(s);
+        this.diagnostic = null;
+    }
+    
+    public JCDiagnostic getDiagnostic() {
+        return diagnostic;
+    }
+
+}
diff --git a/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBAttr.java b/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBAttr.java
--- a/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBAttr.java
+++ b/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBAttr.java
@@ -38,10 +38,14 @@
 package org.netbeans.lib.nbjavac.services;
 
 import com.sun.tools.javac.comp.Attr;
+import com.sun.tools.javac.comp.AttrContext;
+import com.sun.tools.javac.comp.Env;
 import com.sun.tools.javac.tree.JCTree.JCBlock;
 import com.sun.tools.javac.tree.JCTree.JCClassDecl;
 import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Options;
+import org.netbeans.lib.nbjavac.services.NBTreeMaker.MethodDecl;
 
 /**
  *
@@ -58,10 +62,15 @@
     }
 
     private final CancelService cancelService;
+    private final boolean isBackgroundCompilation;
 
     public NBAttr(Context context) {
         super(context);
+        
+        Options options = Options.instance(context);
+        
         cancelService = CancelService.instance(context);
+        isBackgroundCompilation = options.get("backgroundCompilation") != null;     //NOI18N
     }
 
     @Override
@@ -82,4 +91,10 @@
         super.visitBlock(tree);
     }
 
+    @Override
+    protected void methodHeaderAttributed(JCMethodDecl method, Env<AttrContext> localEnv) {
+        if (!isBackgroundCompilation) {
+            ((MethodDecl) method).localEnv = PartialReparser.dupLocalEnv(localEnv);
+        }
+    }
 }
diff --git a/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBClassReader.java b/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBClassReader.java
--- a/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBClassReader.java
+++ b/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBClassReader.java
@@ -45,26 +45,25 @@
 import com.sun.tools.javac.jvm.ClassFile.Version;
 import com.sun.tools.javac.jvm.ClassReader;
 import com.sun.tools.javac.util.Context;
-import com.sun.tools.javadoc.JavadocClassReader;
 
 /**
  *
  * @author lahvac
  */
-public class NBClassReader extends JavadocClassReader {
+public class NBClassReader extends ClassReader {
     
-    public static void preRegister(Context context, final boolean loadDocEnv) {
+    public static void preRegister(Context context) {
         context.put(classReaderKey, new Context.Factory<ClassReader>() {
             public ClassReader make(Context c) {
-                return new NBClassReader(c, loadDocEnv);
+                return new NBClassReader(c);
             }
         });
     }
 
     private final NBNames nbNames;
 
-    public NBClassReader(Context context, boolean loadDocEnv) {
-        super(context, loadDocEnv);
+    public NBClassReader(Context context) {
+        super(context, true);
 
         nbNames = NBNames.instance(context);
 
diff --git a/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBEnter.java b/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBEnter.java
--- a/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBEnter.java
+++ b/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBEnter.java
@@ -69,7 +69,7 @@
         super.visitClassDef(tree);
     }
 
-    @Override
+//    @Override
     protected int getIndex(JCClassDecl clazz) {
         return clazz instanceof IndexedClassDecl ? ((IndexedClassDecl) clazz).index : -1;
     }
diff --git a/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBFlow.java b/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBFlow.java
new file mode 100644
--- /dev/null
+++ b/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBFlow.java
@@ -0,0 +1,90 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, the
+ * "License"). You may not use this file except in compliance with the
+ * License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License.  When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2012 Sun Microsystems, Inc.
+ */
+package org.netbeans.lib.nbjavac.services;
+
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.code.Symbol.VarSymbol;
+import com.sun.tools.javac.comp.Enter;
+import com.sun.tools.javac.comp.Flow;
+import com.sun.tools.javac.tree.JCTree.JCClassDecl;
+import com.sun.tools.javac.tree.TreeMaker;
+import com.sun.tools.javac.util.Context;
+
+/**
+ *
+ * @author lahvac
+ */
+public class NBFlow extends Flow {
+    
+    public static void preRegister(Context context) {
+        context.put(flowKey, new Context.Factory<Flow>() {
+            public Flow make(Context c) {
+                return new NBFlow(c);
+            }
+        });
+    }
+    
+    private final Enter enter;
+    protected NBFlow(Context ctx) {
+        super(ctx);
+        enter = Enter.instance(ctx);
+    }
+
+    @Override
+    protected boolean isTrackable(VarSymbol sym) {
+        return sym != null && sym.owner != null &&
+              (reanalyzedClass == null || ((ClassSymbol)sym.owner).isEnclosedBy(reanalyzedClass.sym));
+    }
+    
+    private JCClassDecl reanalyzedClass;
+    
+    public void reanalyzeMethod (final TreeMaker make, final JCClassDecl classDef) {
+        JCClassDecl oldReanalyzedClass = reanalyzedClass;
+        try {
+            reanalyzedClass = classDef;
+            analyzeTree(enter.getEnv(classDef.sym), make);
+        } finally {
+            reanalyzedClass = oldReanalyzedClass;
+        }
+    }
+    
+}
diff --git a/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBClassReader.java b/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBJavadocClassReader.java
copy from lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBClassReader.java
copy to lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBJavadocClassReader.java
--- a/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBClassReader.java
+++ b/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBJavadocClassReader.java
@@ -51,20 +51,20 @@
  *
  * @author lahvac
  */
-public class NBClassReader extends JavadocClassReader {
+public class NBJavadocClassReader extends JavadocClassReader {
     
-    public static void preRegister(Context context, final boolean loadDocEnv) {
+    public static void preRegister(Context context) {
         context.put(classReaderKey, new Context.Factory<ClassReader>() {
             public ClassReader make(Context c) {
-                return new NBClassReader(c, loadDocEnv);
+                return new NBJavadocClassReader(c);
             }
         });
     }
 
     private final NBNames nbNames;
 
-    public NBClassReader(Context context, boolean loadDocEnv) {
-        super(context, loadDocEnv);
+    public NBJavadocClassReader(Context context) {
+        super(context);
 
         nbNames = NBNames.instance(context);
 
diff --git a/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBJavadocEnter.java b/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBJavadocEnter.java
--- a/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBJavadocEnter.java
+++ b/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBJavadocEnter.java
@@ -95,7 +95,7 @@
         super.visitClassDef(tree);
     }
 
-    @Override
+//    @Override
     protected int getIndex(JCClassDecl clazz) {
         return clazz instanceof IndexedClassDecl ? ((IndexedClassDecl) clazz).index : -1;
     }
diff --git a/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBMemberEnter.java b/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBMemberEnter.java
--- a/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBMemberEnter.java
+++ b/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBMemberEnter.java
@@ -51,7 +51,7 @@
 public class NBMemberEnter extends MemberEnter {
 
     public static void preRegister(Context context) {
-        context.put(MemberEnter.class, new Context.Factory<MemberEnter>() {
+        context.put(memberEnterKey, new Context.Factory<MemberEnter>() {
             public MemberEnter make(Context c) {
                 return new NBMemberEnter(c);
             }
diff --git a/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBParserFactory.java b/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBParserFactory.java
--- a/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBParserFactory.java
+++ b/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBParserFactory.java
@@ -37,13 +37,12 @@
  */
 package org.netbeans.lib.nbjavac.services;
 
-import com.sun.tools.javac.parser.EndPosParser;
 import com.sun.tools.javac.parser.JavacParser;
 import com.sun.tools.javac.parser.Lexer;
 import com.sun.tools.javac.parser.Parser;
 import com.sun.tools.javac.parser.ParserFactory;
-import com.sun.tools.javac.parser.Scanner;
 import com.sun.tools.javac.parser.ScannerFactory;
+import com.sun.tools.javac.parser.Tokens.Comment;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.JCBlock;
 import com.sun.tools.javac.tree.JCTree.JCClassDecl;
@@ -89,42 +88,31 @@
 
     @Override
     public Parser newParser(CharSequence input, boolean keepDocComments, boolean keepEndPos, boolean keepLineMap) {
-        return newParser (input, keepDocComments, keepEndPos, keepLineMap, false);
+        Lexer lexer = scannerFactory.newScanner(input, keepDocComments);
+        return new NBJavacParser(this, lexer, keepDocComments, keepLineMap, keepEndPos, cancelService);
     }
 
-    @Override
-    public Parser newParser(CharSequence input, int startPos, Map<JCTree,Integer> endPos) {
-        Lexer lexer = scannerFactory.newScanner(input, true);
-        ((Scanner)lexer).seek(startPos);
-        JavacParser p = new NBEndPosParser(this, lexer, true, false, endPos, cancelService);
-        return p;
-    }
+//    @Override
+//    public Parser newParser(CharSequence input, int startPos, Map<JCTree,Integer> endPos) {
+//        Lexer lexer = scannerFactory.newScanner(input, true);
+//        ((Scanner)lexer).seek(startPos);
+//        JavacParser p = new NBEndPosParser(this, lexer, true, false, endPos, cancelService);
+//        return p;
+//    }
 
-    @Override
-    public Parser newParser(CharSequence input, boolean keepDocComments, boolean keepEndPos, boolean keepLineMap, boolean partial) {
-        Lexer lexer = scannerFactory.newScanner(input, keepDocComments);
-        JavacParser p;
-        if (keepEndPos) {
-            p = new NBEndPosParser(this, lexer, keepDocComments, keepLineMap, cancelService);
-        } else {
-            p = new NBJavacParser(this, lexer, keepDocComments, keepLineMap, cancelService);
-        }
-        return p;
-    }
-
-    protected static class NBJavacParser extends JavacParser {
+    public static class NBJavacParser extends JavacParser {
 
         private final Names names;
         private final CancelService cancelService;
 
-        public NBJavacParser(NBParserFactory fac, Lexer S, boolean keepDocComments, boolean keepLineMap, CancelService cancelService) {
-            super(fac, S, keepDocComments, keepLineMap);
+        public NBJavacParser(NBParserFactory fac, Lexer S, boolean keepDocComments, boolean keepLineMap, boolean keepEndPos, CancelService cancelService) {
+            super(fac, S, keepDocComments, keepLineMap, keepEndPos);
             this.names = fac.names;
             this.cancelService = cancelService;
         }
 
         @Override
-        protected JCClassDecl classDeclaration(JCModifiers mods, String dc) {
+        protected JCClassDecl classDeclaration(JCModifiers mods, Comment dc) {
             if (cancelService != null) {
                 cancelService.abortIfCanceled();
             }
@@ -132,7 +120,7 @@
         }
 
         @Override
-        protected JCClassDecl interfaceDeclaration(JCModifiers mods, String dc) {
+        protected JCClassDecl interfaceDeclaration(JCModifiers mods, Comment dc) {
             if (cancelService != null) {
                 cancelService.abortIfCanceled();
             }
@@ -140,7 +128,7 @@
         }
 
         @Override
-        protected JCClassDecl enumDeclaration(JCModifiers mods, String dc) {
+        protected JCClassDecl enumDeclaration(JCModifiers mods, Comment dc) {
             if (cancelService != null) {
                 cancelService.abortIfCanceled();
             }
@@ -148,7 +136,7 @@
         }
 
         @Override
-        protected JCTree methodDeclaratorRest(int pos, JCModifiers mods, JCExpression type, Name name, List<JCTypeParameter> typarams, boolean isInterface, boolean isVoid, String dc) {
+        protected JCTree methodDeclaratorRest(int pos, JCModifiers mods, JCExpression type, Name name, List<JCTypeParameter> typarams, boolean isInterface, boolean isVoid, Comment dc) {
             if (cancelService != null) {
                 cancelService.abortIfCanceled();
             }
@@ -164,64 +152,6 @@
 
     }
 
-    public static class NBEndPosParser extends EndPosParser {
-
-        private final Names names;
-        private final CancelService cancelService;
-
-        public NBEndPosParser(NBParserFactory fac, Lexer S, boolean keepDocComments, boolean keepLineMap, CancelService cancelService) {
-            super(fac, S, keepDocComments, keepLineMap);
-            this.names = fac.names;
-            this.cancelService = cancelService;
-        }
-
-        public NBEndPosParser(NBParserFactory fac, Lexer S, boolean keepDocComments, boolean keepLineMap, Map<JCTree, Integer> endPositions, CancelService cancelService) {
-            super(fac, S, keepDocComments, keepLineMap, endPositions);
-            this.names = fac.names;
-            this.cancelService = cancelService;
-        }
-
-        @Override
-        protected JCClassDecl classDeclaration(JCModifiers mods, String dc) {
-            if (cancelService != null) {
-                cancelService.abortIfCanceled();
-            }
-            return super.classDeclaration(mods, dc);
-        }
-
-        @Override
-        protected JCClassDecl interfaceDeclaration(JCModifiers mods, String dc) {
-            if (cancelService != null) {
-                cancelService.abortIfCanceled();
-            }
-            return super.interfaceDeclaration(mods, dc);
-        }
-
-        @Override
-        protected JCClassDecl enumDeclaration(JCModifiers mods, String dc) {
-            if (cancelService != null) {
-                cancelService.abortIfCanceled();
-            }
-            return super.enumDeclaration(mods, dc);
-        }
-
-        @Override
-        protected JCTree methodDeclaratorRest(int pos, JCModifiers mods, JCExpression type, Name name, List<JCTypeParameter> typarams, boolean isInterface, boolean isVoid, String dc) {
-            if (cancelService != null) {
-                cancelService.abortIfCanceled();
-            }
-            return super.methodDeclaratorRest(pos, mods, type, name, typarams, isInterface, isVoid, dc);
-        }
-        
-        @Override
-        public JCCompilationUnit parseCompilationUnit() {
-            JCCompilationUnit toplevel = super.parseCompilationUnit();
-            assignAnonymousClassIndices(names, toplevel, null, -1);
-            return toplevel;
-        }
-
-    }
-
     public static void assignAnonymousClassIndices(Names names, JCTree tree, Name name, int startNumber) {
         AssignAnonymousIndices aai = new AssignAnonymousIndices(names);
 
diff --git a/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBTreeMaker.java b/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBTreeMaker.java
--- a/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBTreeMaker.java
+++ b/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBTreeMaker.java
@@ -42,14 +42,20 @@
 package org.netbeans.lib.nbjavac.services;
 
 import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.code.Symbol.MethodSymbol;
 import com.sun.tools.javac.code.Symtab;
 import com.sun.tools.javac.code.Types;
+import com.sun.tools.javac.comp.AttrContext;
+import com.sun.tools.javac.comp.Env;
 import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.JCBlock;
 import com.sun.tools.javac.tree.JCTree.JCClassDecl;
 import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
 import com.sun.tools.javac.tree.JCTree.JCExpression;
+import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
 import com.sun.tools.javac.tree.JCTree.JCModifiers;
 import com.sun.tools.javac.tree.JCTree.JCTypeParameter;
+import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
 import com.sun.tools.javac.tree.TreeMaker;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.List;
@@ -102,6 +108,13 @@
         return result;
     }
 
+    @Override
+    public JCMethodDecl MethodDef(JCModifiers mods, Name name, JCExpression restype, List<JCTypeParameter> typarams, List<JCVariableDecl> params, List<JCExpression> thrown, JCBlock body, JCExpression defaultValue) {
+        return new MethodDecl(mods, name, restype, typarams, params, thrown, body, defaultValue, null);
+    }
+    
+    
+
     public static class IndexedClassDecl extends JCClassDecl {
         public int index;
         protected IndexedClassDecl(JCModifiers mods,
@@ -115,4 +128,20 @@
             this.index = -1;
         }
     }
+    
+    public static class MethodDecl extends JCMethodDecl {
+        public Env<AttrContext> localEnv = null;
+        protected MethodDecl(JCModifiers mods,
+                            Name name,
+                            JCExpression restype,
+                            List<JCTypeParameter> typarams,
+                            List<JCVariableDecl> params,
+                            List<JCExpression> thrown,
+                            JCBlock body,
+                            JCExpression defaultValue,
+                            MethodSymbol sym) {
+            super(mods, name, restype, typarams, params, thrown, body, defaultValue, sym);
+        }
+        
+    }
 }
diff --git a/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/PartialReparser.java b/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/PartialReparser.java
--- a/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/PartialReparser.java
+++ b/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/PartialReparser.java
@@ -56,7 +56,10 @@
 import com.sun.tools.javac.comp.Flow;
 import com.sun.tools.javac.comp.MemberEnter;
 import com.sun.tools.javac.parser.JavacParser;
+import com.sun.tools.javac.parser.Lexer;
 import com.sun.tools.javac.parser.ParserFactory;
+import com.sun.tools.javac.parser.Scanner;
+import com.sun.tools.javac.parser.ScannerFactory;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.JCBlock;
 import com.sun.tools.javac.tree.JCTree.JCClassDecl;
@@ -72,6 +75,7 @@
 import com.sun.tools.javac.util.Names;
 import java.nio.CharBuffer;
 import java.util.Map;
+import org.netbeans.lib.nbjavac.services.NBTreeMaker.MethodDecl;
 
 /**
  *
@@ -101,12 +105,13 @@
             final Map<? super JCTree,? super String> docComments) {
         ParserFactory parserFactory = ParserFactory.instance(context);
         CharBuffer buf = CharBuffer.wrap((newBodyText+"\u0000").toCharArray(), 0, newBodyText.length());
-        JavacParser parser = (JavacParser) parserFactory.newParser(buf, ((JCBlock)methodToReparse.getBody()).pos, ((JCCompilationUnit)topLevel).endPositions);
+//        JavacParser parser = (JavacParser) parserFactory.newParser(buf, ((JCBlock)methodToReparse.getBody()).pos, ((JCCompilationUnit)topLevel).endPositions);
+        JavacParser parser = (JavacParser) parserFactory.newParser(buf, true, true, true);//((JCBlock)methodToReparse.getBody()).pos, ((JCCompilationUnit)topLevel).endPositions);
         final JCStatement statement = parser.parseStatement();
         NBParserFactory.assignAnonymousClassIndices(Names.instance(context), statement, Names.instance(context).empty, annonIndex);
         if (statement.getKind() == Tree.Kind.BLOCK) {
             if (docComments != null) {
-                docComments.putAll(parser.getDocComments());
+//                docComments.putAll(parser.getDocComments());
             }
             return (JCBlock) statement;
         }
@@ -115,14 +120,15 @@
 
     public BlockTree reattrMethodBody(MethodTree methodToReparse, BlockTree block) {
         Attr attr = Attr.instance(context);
-        assert ((JCMethodDecl)methodToReparse).localEnv != null;
-        JCMethodDecl tree = (JCMethodDecl) methodToReparse;
+        assert methodToReparse instanceof MethodDecl;
+        assert ((MethodDecl)methodToReparse).localEnv != null;
+        MethodDecl tree = (MethodDecl) methodToReparse;
         final Names names = Names.instance(context);
         final Symtab syms = Symtab.instance(context);
         final MemberEnter memberEnter = MemberEnter.instance(context);
         final Log log = Log.instance(context);
         final TreeMaker make = TreeMaker.instance(context);
-        final Env<AttrContext> env = attr.dupLocalEnv(((JCMethodDecl) methodToReparse).localEnv);
+        final Env<AttrContext> env = dupLocalEnv(tree.localEnv);
         final ClassSymbol owner = env.enclClass.sym;
         if (tree.name == names.init && !owner.type.isErroneous() && owner.type != syms.objectType) {
             JCBlock body = tree.body;
@@ -149,12 +155,15 @@
     }
 
     public BlockTree reflowMethodBody(CompilationUnitTree topLevel, ClassTree ownerClass, MethodTree methodToReparse) {
-        Flow flow = Flow.instance(context);
+        NBFlow flow = (NBFlow) Flow.instance(context);
         TreeMaker make = TreeMaker.instance(context);
         flow.reanalyzeMethod(make.forToplevel((JCCompilationUnit)topLevel),
                 (JCClassDecl)ownerClass);
         return methodToReparse.getBody();
     }
 
+    public static Env<AttrContext> dupLocalEnv(Env<AttrContext> localEnv) {
+        return localEnv.dup(localEnv.tree, localEnv.info.dup(localEnv.info.scope.dupUnshared()));
+    }
 
 }
diff --git a/lib.nbjavac/test/unit/src/org/netbeans/lib/nbjavac/services/NBClassWriterTest.java b/lib.nbjavac/test/unit/src/org/netbeans/lib/nbjavac/services/NBClassWriterTest.java
--- a/lib.nbjavac/test/unit/src/org/netbeans/lib/nbjavac/services/NBClassWriterTest.java
+++ b/lib.nbjavac/test/unit/src/org/netbeans/lib/nbjavac/services/NBClassWriterTest.java
@@ -109,7 +109,7 @@
 
         final JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, std, null, Arrays.asList("-bootclasspath",  bootPath, "-source", "1.4", "-target", "1.4"), null, Arrays.asList(new MyFileObject(code)));
 
-        NBClassReader.preRegister(ct.getContext(), false);
+        NBJavadocClassReader.preRegister(ct.getContext(), false);
         NBClassWriter.preRegister(ct.getContext());
 
         ct.call();
@@ -127,7 +127,7 @@
 
         JavacTaskImpl ct = (JavacTaskImpl)tool.getTask(null, std, null, Arrays.asList("-bootclasspath",  bootPath), null, Arrays.<JavaFileObject>asList());
 
-        NBClassReader.preRegister(ct.getContext(), false);
+        NBJavadocClassReader.preRegister(ct.getContext(), false);
         NBClassWriter.preRegister(ct.getContext());
         
         PackageElement pack = ct.getElements().getPackageElement(packageName);
diff --git a/libs.javacapi/build.xml b/libs.javacapi/build.xml
--- a/libs.javacapi/build.xml
+++ b/libs.javacapi/build.xml
@@ -45,4 +45,17 @@
 -->
 <project name="libs.javacapi" default="netbeans" basedir=".">
     <import file="../nbbuild/templates/projectized.xml"/>
+    <target name="-check-nb-javac-exists">
+        <available property="nb-javac.exists" file="../nb-javac/make/netbeans/nb-javac/build.xml"/>
+    </target>
+    <target name="-release.files-build-javac" if="nb-javac.exists">
+        <ant dir="../nb-javac/make/netbeans/nb-javac" target="jar" inheritAll="false"/>
+        <copy file="../nb-javac/make/netbeans/nb-javac/dist/javac-api.jar" tofile="external/nb-javac-api.jar" overwrite="true"/>
+        <property name="release.files.extra" value="modules/ext/nb-javac-api.jar"/>
+    </target>
+    <target name="-release.files-delegate" unless="nb-javac.exists">
+        <antcall target="projectized.-release.files" />
+        <property name="release.files.extra" value="modules/ext/nb-javac-api.jar"/>
+    </target>
+    <target name="-release.files" depends="-check-nb-javac-exists,-release.files-build-javac,-release.files-delegate" />
 </project>
diff --git a/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Hacks.java b/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Hacks.java
--- a/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Hacks.java
+++ b/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Hacks.java
@@ -106,10 +106,10 @@
         Log.instance(context).nerrors = 0;
 
         JavaFileObject jfo = FileObjects.memoryFileObject("$$", "$", new File("/tmp/t.java").toURI(), System.currentTimeMillis(), clazz.toString());
-        boolean oldSkipAPs = jc.skipAnnotationProcessing;
+//        boolean oldSkipAPs = jc.skipAnnotationProcessing;
 
         try {
-            jc.skipAnnotationProcessing = true;
+//            jc.skipAnnotationProcessing = true;
 
             Iterable<? extends CompilationUnitTree> parsed = jti.parse(jfo);
             CompilationUnitTree cut = parsed.iterator().next();
@@ -121,7 +121,7 @@
             Exceptions.printStackTrace(ex);
             return null;
         } finally {
-            jc.skipAnnotationProcessing = oldSkipAPs;
+//            jc.skipAnnotationProcessing = oldSkipAPs;
         }
     }
 
diff --git a/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Utilities.java b/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Utilities.java
--- a/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Utilities.java
+++ b/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Utilities.java
@@ -84,7 +84,8 @@
 import com.sun.tools.javac.parser.ParserFactory;
 import com.sun.tools.javac.parser.Scanner;
 import com.sun.tools.javac.parser.ScannerFactory;
-import com.sun.tools.javac.parser.Token;
+import com.sun.tools.javac.parser.Tokens.Token;
+import com.sun.tools.javac.parser.Tokens.TokenKind;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.JCCase;
 import com.sun.tools.javac.tree.JCTree.JCCatch;
@@ -100,7 +101,6 @@
 import com.sun.tools.javac.util.ListBuffer;
 import com.sun.tools.javac.util.Log;
 import com.sun.tools.javac.util.Names;
-import com.sun.tools.javac.util.Position.LineMap;
 import com.sun.tools.javadoc.Messager;
 import java.io.File;
 import java.io.IOException;
@@ -161,7 +161,7 @@
 import org.netbeans.modules.java.source.builder.TreeFactory;
 import org.netbeans.lib.nbjavac.services.CancelService;
 import org.netbeans.lib.nbjavac.services.NBParserFactory;
-import org.netbeans.lib.nbjavac.services.NBParserFactory.NBEndPosParser;
+import org.netbeans.lib.nbjavac.services.NBParserFactory.NBJavacParser;
 import org.netbeans.modules.java.source.parsing.FileObjects;
 import org.netbeans.modules.java.source.pretty.ImportAnalysis2;
 import org.netbeans.modules.java.source.transform.ImmutableTreeTranslator;
@@ -601,7 +601,7 @@
                     pos[0] = new ParserSourcePositions((JavacParser)parser);
                 JCExpression result = parser.parseExpression();
 
-                if (!onlyFullInput || scanner.token() == Token.EOF) {
+                if (!onlyFullInput || scanner.token().kind == TokenKind.EOF) {
                     return result;
                 }
             }
@@ -729,12 +729,12 @@
         JavaFileObject jfo = FileObjects.memoryFileObject("$", "$", new File("/tmp/$" + count + ".java").toURI(), System.currentTimeMillis(), clazz.toString());
 
         DiagnosticListener<? super JavaFileObject> old = log.getDiagnosticListener();
-        boolean oldSkipAPs = compiler.skipAnnotationProcessing;
+//        boolean oldSkipAPs = compiler.skipAnnotationProcessing;
         DiagnosticCollector<JavaFileObject> dc = new DiagnosticCollector<JavaFileObject>();
 
         try {
             log.setDiagnosticListener(dc);
-            compiler.skipAnnotationProcessing = true;
+//            compiler.skipAnnotationProcessing = true;
             
             JCCompilationUnit cut = compiler.parse(jfo);
 
@@ -764,7 +764,7 @@
             log.nerrors = origNErrors;
             log.nwarnings = origNWarnings;
             log.deferDiagnostics = origDeferDiagnostic;
-            compiler.skipAnnotationProcessing = oldSkipAPs;
+//            compiler.skipAnnotationProcessing = oldSkipAPs;
         }
     }
 
@@ -1227,28 +1227,30 @@
         }
     }
 
-    private static class JackpotJavacParser extends NBEndPosParser {
+    private static class JackpotJavacParser extends NBJavacParser {
 
         private final Context ctx;
+        private final com.sun.tools.javac.util.Name dollar;
         public JackpotJavacParser(Context ctx, NBParserFactory fac,
                          Lexer S,
                          boolean keepDocComments,
                          boolean keepLineMap,
                          CancelService cancelService,
                          Names names) {
-            super(fac, new PushbackLexer(S), keepDocComments, keepLineMap, cancelService);
+            super(fac, S, keepDocComments, keepLineMap, true, cancelService);
             this.ctx = ctx;
+            this.dollar = names.fromString("$");
         }
 
         @Override
         protected JCModifiers modifiersOpt(JCModifiers partial) {
-            if (S.token() == Token.IDENTIFIER) {
-                String ident = S.stringVal();
+            if (token.kind == TokenKind.IDENTIFIER) {
+                String ident = token.name().toString();
 
                 if (Utilities.isMultistatementWildcard(ident)) {
-                    com.sun.tools.javac.util.Name name = S.name();
+                    com.sun.tools.javac.util.Name name = token.name();
 
-                    S.nextToken();
+                    nextToken();
 
                     return new ModifiersWildcard(name, F.Ident(name));
                 }
@@ -1257,14 +1259,13 @@
             return super.modifiersOpt(partial);
         }
 
-        protected JCVariableDecl formalParameter() {
-            if (S.token() == Token.IDENTIFIER) {
-                String ident = S.stringVal();
+        @Override
+        public JCVariableDecl formalParameter() {
+            if (token.kind == TokenKind.IDENTIFIER) {
+                if (token.name().startsWith(dollar)) {
+                    com.sun.tools.javac.util.Name name = token.name();
 
-                if (ident.startsWith("$")) {
-                    com.sun.tools.javac.util.Name name = S.name();
-
-                    S.nextToken();
+                    nextToken();
 
                     return new VariableWildcard(ctx, name, F.Ident(name));
                 }
@@ -1275,35 +1276,20 @@
 
         @Override
         protected JCCatch catchClause() {
-            if (S.token() == Token.CATCH) {
-                int origPos = S.pos();
-//                S.pushState();
+            if (token.kind == TokenKind.CATCH) {
+                Token peeked = S.token(1);
                 
-                Token peeked;
-                String ident;
-                
-//                try {
-                    S.nextToken();
+                if (   peeked.kind == TokenKind.IDENTIFIER
+                    && Utilities.isMultistatementWildcard(peeked.name().toString())) {
+                    accept(TokenKind.CATCH);
+                    
+                    com.sun.tools.javac.util.Name name = token.name();
 
-                    peeked =  S.token();
-                    ident = S.stringVal();
-//                } finally {
-//                    S.popState();
-//                }
-                
-                if (   peeked == Token.IDENTIFIER
-                    && Utilities.isMultistatementWildcard(ident)) {
-                    accept(Token.CATCH);
-                    
-                    com.sun.tools.javac.util.Name name = S.name();
-
-                    accept(Token.IDENTIFIER);
+                    accept(TokenKind.IDENTIFIER);
 
                     return new CatchWildcard(ctx, name, F.Ident(name));
                 } else {
-                    ((PushbackLexer) S).add(Token.CATCH, origPos, null);
-                    ((PushbackLexer) S).add(null, -1, null);
-                    S.nextToken();
+                    nextToken();
                 }
             }
             return super.catchClause();
@@ -1311,24 +1297,18 @@
 
         @Override
         public com.sun.tools.javac.util.List<JCTree> classOrInterfaceBodyDeclaration(com.sun.tools.javac.util.Name className, boolean isInterface) {
-            if (S.token() == Token.IDENTIFIER) {
-                int identPos = S.pos();
-                String ident = S.stringVal();
+            if (token.kind == TokenKind.IDENTIFIER) {
+                if (token.name().startsWith(dollar)) {
+                    com.sun.tools.javac.util.Name name = token.name();
 
-                if (ident.startsWith("$")) {
-                    com.sun.tools.javac.util.Name name = S.name();
+                    Token peeked = S.token(1);
 
-                    S.nextToken();
-                    
-                    if (S.token() == Token.SEMI) {
-                        S.nextToken();
+                    if (peeked.kind == TokenKind.SEMI) {
+                        nextToken();
+                        nextToken();
                         
                         return com.sun.tools.javac.util.List.<JCTree>of(F.Ident(name));
                     }
-                    
-                    ((PushbackLexer) S).add(Token.IDENTIFIER, identPos, name);
-                    ((PushbackLexer) S).add(null, -1, null);
-                    S.nextToken();
                 }
             }
             return super.classOrInterfaceBodyDeclaration(className, isInterface);
@@ -1336,7 +1316,7 @@
         
         @Override
         protected JCExpression checkExprStat(JCExpression t) {
-            if (t.getTag() == JCTree.IDENT) {
+            if (t.getTag() == JCTree.Tag.IDENT) {
                 if (((IdentifierTree) t).getName().toString().startsWith("$")) {
                     return t;
                 }
@@ -1346,31 +1326,27 @@
 
         @Override
         protected JCCase switchBlockStatementGroup() {
-            if (S.token() == Token.CASE) {
-                int origPos = S.pos();
+            if (token.kind == TokenKind.CASE) {
+                Token peeked = S.token(1);
 
-                S.nextToken();
-
-                if (S.token() == Token.IDENTIFIER) {
-                    String ident = S.stringVal();
+                if (peeked.kind == TokenKind.IDENTIFIER) {
+                    String ident = peeked.name().toString();
 
                     if (ident.startsWith("$") && ident.endsWith("$")) {
-                        int pos = S.pos();
-                        com.sun.tools.javac.util.Name name = S.name();
+                        nextToken();
+                        
+                        int pos = token.pos;
+                        com.sun.tools.javac.util.Name name = token.name();
 
-                        S.nextToken();
+                        nextToken();
 
-                        if (S.token() == Token.SEMI) {
-                            S.nextToken();
+                        if (token.kind == TokenKind.SEMI) {
+                            nextToken();
                         }
 
                         return new JackpotTrees.CaseWildcard(ctx, name, F.at(pos).Ident(name));
                     }
                 }
-
-                ((PushbackLexer) S).add(Token.CASE, origPos, null);
-                ((PushbackLexer) S).add(null, -1, null);
-                S.nextToken();
             }
 
             return super.switchBlockStatementGroup();
@@ -1379,15 +1355,14 @@
 
         @Override
         protected JCTree resource() {
-            if (S.token() == Token.IDENTIFIER && S.stringVal().startsWith("$")) {
-                //XXX: should inspect the next token, not next character:
-                char[] maybeSemicolon = S.getRawCharacters(S.endPos(), S.endPos() + 1);
+            if (token.kind == TokenKind.IDENTIFIER && token.name().startsWith(dollar)) {
+                Token peeked = S.token(1);
 
-                if (maybeSemicolon[0] == ';' || maybeSemicolon[0] == ')') {
-                    int pos = S.pos();
-                    com.sun.tools.javac.util.Name name = S.name();
+                if (peeked.kind == TokenKind.SEMI || peeked.kind == TokenKind.RPAREN) {
+                    int pos = token.pos;
+                    com.sun.tools.javac.util.Name name = token.name();
 
-                    S.nextToken();
+                    nextToken();
 
                     return F.at(pos).Ident(name);
                 }
@@ -1397,109 +1372,6 @@
 
     }
 
-    private static final class PushbackLexer implements Lexer {
-
-        private final Lexer delegate;
-        private final List<Token> tokenBuffer;
-        private final List<Integer> posBuffer;
-        private final List<com.sun.tools.javac.util.Name> nameBuffer;
-        private Token currentBufferToken;
-        private int   currentBufferPos;
-        private com.sun.tools.javac.util.Name currentBufferName;
-
-        public PushbackLexer(Lexer delegate) {
-            this.delegate = delegate;
-            this.tokenBuffer = new LinkedList<Token>();
-            this.posBuffer = new LinkedList<Integer>();
-            this.nameBuffer = new LinkedList<com.sun.tools.javac.util.Name>();
-        }
-
-        public void add(Token token, int pos, com.sun.tools.javac.util.Name name) {
-            tokenBuffer.add(token);
-            posBuffer.add(pos);
-            nameBuffer.add(name);
-        }
-        
-        public void token(Token token) {
-            delegate.token(token);
-        }
-
-        public Token token() {
-            if (currentBufferToken != null) return currentBufferToken;
-            return delegate.token();
-        }
-
-        public String stringVal() {
-            if (currentBufferToken != null) return currentBufferName != null ? currentBufferName.toString() : null;
-            return delegate.stringVal();
-        }
-
-        public void resetDeprecatedFlag() {
-            delegate.resetDeprecatedFlag();
-        }
-
-        public int radix() {
-            return delegate.radix();
-        }
-
-        public int prevEndPos() {
-            return delegate.prevEndPos();
-        }
-
-        public int pos() {
-            if (currentBufferToken != null) return currentBufferPos;
-            return delegate.pos();
-        }
-
-        public void nextToken() {
-            if (!tokenBuffer.isEmpty()) {
-                currentBufferToken = tokenBuffer.remove(0);
-                currentBufferPos = posBuffer.remove(0);
-                currentBufferName  = nameBuffer.remove(0);
-            }
-            else delegate.nextToken();
-        }
-
-        public com.sun.tools.javac.util.Name name() {
-            if (currentBufferToken != null) return currentBufferName;
-            return delegate.name();
-        }
-
-        public char[] getRawCharacters(int beginIndex, int endIndex) {
-            return delegate.getRawCharacters(beginIndex, endIndex);
-        }
-
-        public char[] getRawCharacters() {
-            return delegate.getRawCharacters();
-        }
-
-        public LineMap getLineMap() {
-            return delegate.getLineMap();
-        }
-
-        public void errPos(int pos) {
-            delegate.errPos(pos);
-        }
-
-        public int errPos() {
-            return delegate.errPos();
-        }
-
-        public int endPos() {
-            return delegate.endPos();
-        }
-
-        public String docComment() {
-            return delegate.docComment();
-        }
-
-        public boolean deprecatedFlag() {
-            return delegate.deprecatedFlag();
-        }
-        
-        
-    }
-
     private static final class DummyJFO extends SimpleJavaFileObject {
         private DummyJFO() {
             super(URI.create("dummy.java"), JavaFileObject.Kind.SOURCE);
@@ -1547,7 +1419,7 @@
                     IdentifierTree it = (IdentifierTree) mit.getMethodSelect();
 
                     if ("super".equals(it.getName().toString())) {
-                        return ((JCCompilationUnit) cut).endPositions.get(tree) == (-1);
+                        return ((JCCompilationUnit) cut).endPositions.getEndPos(tree) == (-1);
                     }
                 }
             }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.