NetBeansNewfeaturesandimprovementsinthenextreleaseofNetBeansmakeitabetterIDEforanykindofdeveloper.
Fromeditingtobrowsing,versioning,building,debugging,profilingorvisualdesign,therearegreatnewsforeverybody.
NewCoreFeaturesinDepthOsvaldoDoederlein6.
0IssueThreeNNetBeans6.
0:NewCoreFeaturesinDepthIt'sthattimeagain.
Amajor,dot-zeroreleaseofNetBeanswillbeavailablesoon–aboutayearandahalfafter5.
0,whichintroducedsignificantnewfeaturesliketheMatisseGUIbuilder,andextensiveimprovementsinCVSintegration,webservicesandmoduledevelopment,tocitebutafew.
Incontrast,version5.
5focusedoutsidethecoreIDEbysupportingseveralnewPacksthatincreasedNetBeans'over-allfunctionalitytoalevelstillunmatchedbyanyotheropen-sourceIDE.
Now,isNetBeans6.
0worthyofthebumpinthemajorversionnumberYoubetitis,andinthisarticlewe'lllookatsomeofthemostimportantandinterestingnewfeaturesinthecoreIDE.
Javac-poweredLet'sbeginbylookingnotatanend-userfeaturebutatacoreIDEtechnologythatprovidesthefoundationformanyenhance-ments.
PastreleasesofNetBeans,likemanyotherprogrammingtools,containedcustomcodetoparseJavasourcesandassistincodeunderstandingandmanipula-tiontasks(likerefactorings,hintsandfixes,outlining,etc).
Theresultwassometimeslimitedfunctionality:simplehighlighting,non-bulletproofrefactorings,andthelackofsupportforfeatureslikecodecomple-tioneverywhereJavacodeappears.
TheobvioussolutionwouldbereusingthematuretechnologyofthejavaccompilertodoallJavasourceprocessing.
ButjavacwasnotdesignedtosupporttherequirementsofamodernIDE:itwaswrittenandtunedforbatchexecution,andtoacceptasinputfullcompilationunits,performacompletecom-pilationandproduce.
classfilesasoutput.
IDEshaveverydifferentrequirements,amongwhichthemostcriti-calisworkinginmemoryonly.
Supposethataftereachcharacteryoutype,theIDEwantstoanalyzetheentireclassagainsoitcanupdatesyntaxerrorindications,performhighlighting,andprovideotherfeaturesthatdependonthecodestructure.
Oneoptionwouldbetowritetheeditor'scurrentcontenttoatemporaryfile,invokejavacandparsetheresulting.
classfiles.
Butthiswouldbeveryinefficient.
Amuchbettersolutionistocalljavacinthesameprocess(asalocallibrary),thenpassthecurrentsourcesasanin-memoryparam-eterandreceiveinreturnthedatastructurescontainingthesameinformationthatwouldbepresentintheclassfiles(whichwouldn'tneedtobecreated).
UptoJavaSE5,thissolutionwouldbepos-sible,butonlyusingtheproprietary–andoftenunstable–internalAPIsofaJavacompiler.
ThissituationchangedwithJavaSE6,whichintroducedJSR199(JavaCompilerAPI)andJSR269(PluggableAnnotationProcess-ingAPI).
TheJavaCompilerAPIenablestightandefficientintegra-tionwithjavac(andotherJavasourcecompilers),andJSR269–althoughinitiallydesignedforannotationprocessing–providesasource-levelequivalentofreflectionmetadata.
Workingtogether,thesenewAPIsallowIDEsandothertoolstodigdeeplyintothestructuralinformationthatjavacextractsfromsourcecode.
Addi-tionally,javac'simplementationwasenhancedandtunedforembed-dedandinteractiveuse.
NetBeanswasheavilyupdatedtointegratewiththesenewcapa-bilities,enablingmanyimprovementsintheIDE(discussedbelow).
Thechangesalsopromisefuturebenefits:whenJavaSE7comesoutwithanewsetoflanguageenhancements,youshouldexpectNetBeans'toolsettocatchupveryfast.
AneweditorCommonsensesaysnoproductcanbeperfectineverythingitdoes,butNetBeansisgettingclosereachday.
Historically,Net-BeansusershavebeenproudoftheIDE'scompletecoverageofJavaplatformsfromMEtoEE,itssupportforeffectiveGUIbuilding,anditsintuitiveUIandopenarchitecture.
Ontheotherhand,theIDElaggedincertainareas,likeinthecodeeditororrefactoring.
Thiscouldputoffprogrammersveryfocusedinsourcecode…typeswho'llpickemacsovervisualdesignersanyday.
Well,theseprob-lemsarenomorewithNetBeans6.
0.
IssueThreeNjackpot.
netbeans.
orgTheJackpotproject.
www.
netbeans.
info/downloads/dev.
phpNetBeans6.
0developmentbuilds.
CoreIDENNetBeansMagazineAST-basedselectionSelectingwordsorlinesisgoodenoughfortexteditors,butwhenworkingwithsourcesyouoftenneedtoworkwithrangesoftextthatformcoherentpiecesofcode.
Sayyouwanttocopyallthecodeinsideaforloopbody1inordertopasteitinanotherloopwithsimilarlogic.
Justplacethecursorinanyblankpositioninsidetheloopbody,pressAlt+Shift+Upandyou'redone.
Theeditorselectstheinnermostrangeoftextthatincludesthecursorposition,anddelimitsanodeofthesource'sAbstractSyntaxTree.
TheJavacompiler(asdomostcompilers)parsessourcecodeintoanintermediaryrepresentation,whichisstructuredasatree.
Eachnodeinthisdatastructure(calledanAbstractSyntaxTree)representsacodeelement:aclass,method,statement,block,identifier,operator,literal,etc.
ThoughcodeprocessingtoolsusuallymanipulateprogramsasASTs,manyuseasimpleparserthatproducesonlyabasictree.
The"full"ASTproducedbyacompletecompilerlikejavac,whichiscapableofsemanticanalysisandcodegeneration,willcontainverydetailedandreliableinformationabouteachnode.
Forexample,thenodeforanidentifierholdsnotonlyitsnamebutalsoitstypeandits"definiteassignment"status(whethertheidentifierisguaranteedtobeinitializedatagivenpoint);itcanevenholditsstatically-calculatedvalue(whenapplicable).
ToolsthatworkontopofafullASTaremuchmorepowerfulandreliable.
Thedifferencewon'tbenoticeableforasimpleselectionfeature,butitmaybeverysignificantformoresophisticatedfunctionalitylikerefactorings.
EPressingAlt+Shift+Upagainexpandstheselectiontothenextouternode,inthiscasethecompleteforstatement;thenanewkey-strokemayselecttheentiremethod,andsoforth.
Alt+Shift+Downwillretracttheselectiontoaninnernode.
Figure1showsthisfeaturebeingusedtoselectamulti-linestatementeasilyandprecisely.
Ibetyouwillquicklybehookedonthisfeatureandforgetaboutalltheotherselectionshortcuts!
There'snothinglikeacodeeditorthatgrokscode,nottext.
SemantichighlighterTheeditor'ssyntaxhighlighterwaspro-motedtoasemantics-awarehighlighter.
Itcanapplystylesbasednotonlyonthetypesoftokens(likeidentifiers,operatorsorcomments),butalsobasedondifferentmeaningsthatakintokensmayhave–forinstance,anidentifiermaybeaclassnameoralocalvariablename,aparameter,aconstantfield,etc.
1Dependingonyourbracingstyle,thismaynotbeaseasyasselectingafewfulllines.
Therearemanyotherexamples,likeselectingacomplexexpressionthatspansmultiplelines.
Figure1Severalneweditorfeaturesinaction.
ASemantichighlighting(e.
g.
,identifyingusagesofgetImage(),andstaticvariablesinitalics)Keywordcompletionatamethod'sparameterlist.
Hierarchyview(openedonPaintCanvas)AST-basedselectionIssueThreeNNetBeans6.
0:NewCoreFeaturesinDepthOnebenefitofsemantichighlightingisthatithelpsyoutakeextracarewhenas-signingtostaticfields(sincemanythread-safetyandmemory-leakbugsinvolvestat-ics).
Figure1showsthisoff;noticethatstaticfields(andreferencestothese)ap-pearinitalics.
Thereareotherpowerfulusesforthenewhighlightingengine:Identifyingusages–Selectanyidenti-fier,andtheeditorhighlightsallitsusesinthesamecompilationunit.
Again,Figure1exemplifiesthis:clickingonamethodname,allinvocationstoitarehigh-lighted.
Flagging"Smellycode"–Theneweditorhighlightsunusedvariablesandimports,aswellasusageofdeprecatedclassesandmethods.
Youdon'tneedtoperformabuildorrunacodelinttooltodetectthesesim-ple(butfrequent)problemsanymore.
Exitandthrowpoints–Selectingamethod'sreturntypewillhighlightallreturnstatements.
Selectinganexceptioninthemethod'sthrowslistwillflagallthrow'softhatexceptiontype.
Allinvocationstoothermethodsthatmaythrowthesameexcep-tionarealsoflagged.
BettercodecompletionThebewilderingamountofAPIsyouhavetousethesedaysmakescodecompletiononeofthemostcriticalfeaturesofanymoderncodeeditor.
NetBeans6.
0haslearnedmanynewtrickshere:Keywordcompletion–Ifyou'vejusttypedapackagedeclarationinanewsourcefile(forexample),Alt+Spacewillbringonlythekeywordsthatarelegalinthatposition:abstract,class,enum,final,import,inter-faceandpublic.
Figure1showsanotherexample:aftertheopeningparenthesisofamethoddeclaration,thepreferredcompletionsareallprimitivetypes.
Type-basedvariablenames–Completingat"ConfigurationFile_",theeditorwillofferthevariablenamescf,configurationFileandfile.
(I'musing"_"torepresentthecursorposition.
)Generics-awarecompletions–Whenassigningavariablewithagenerictypetoanewexpression,theeditorwillofferallcompatibletypes,includinggenericarguments.
Forexample,at"Mapm=new_",codecompletionlistsallimplementationsofMap,eachwiththesameparameters.
Annotation-awarecompletions–Whencompletingafter"@",you'llbeofferedalltheannotationsthatcanbeusedinthegivenscope.
Andiftheselectedannotationrequiresparameterstheeditorwillprovidecompletionsforthesetoo.
Passingparameters–At"x=m(_",thetopcompletionswillbevaluesinscopethatarecompatiblewithm()'sfirstparameter.
Ifthemethod'sparameternamesareavailableandtherearevariableswithsimilarnamesinscope,thisisusedtosortthecompletionsfurther.
You'llalsobeofferedfullcompletionswiththeparameterlistfilledwiththosevariables.
Commonconstructors–Whenyouinvokecodecompletionwiththecursorpositionedbetweenclassmembers,you'llbeofferedtocreateaconstructorwithoutargumentsandonethatreceivesinitialvaluesforallfields(iftheseconstructorsdon'talreadyexist).
Catchingexceptions–Completionat"catch(_"willonlyofferex-ceptionsthatarethrowninthecorrespondingtryblock,buthaven'tbeenhandledyetbypreviouscatchblocks.
NewbrowsingviewsTheeditorintroducesseveralnewviewsforsourcecodebrowsing.
TheMembersviewshowsthemembersofaJavatypetogetherwiththeirjavadocs,makingiteasytofindaparticularmethod,fieldorinnerclass.
TheHierarchyviewshowstheinheritancetreeofaJavatype.
Figure1demonstratesthisview;noticethefilterbuttonsthatletyoutogglebetweensupertypesorsubtypesandbetweensimpleandfullyqualifiedclassnames.
Youcanalsochoosewhetherornottoshowinnerclassesandinterfaces.
TheDeclarationviewsummarizesthedeclarationoftheselectedJavaelement(type,methodorfield).
Despiteitsname,thisviewalsoshowstheinspectedelement'ssourcecodeifit'savailable.
TheDeclarationViewisespeciallyusefulwheninvokingcodestillunderCoreIDENNetBeansMagazine2Adevelopment,notyetdocumentedwithjavadoc.
Finally,theJavadocviewshowsthejavadocsfortheselectedJavaelement.
EditableDiffandInlineDiffTheeditor'simprovedarchitecturemakesiteasierforvariousfea-turesthathandlesourcecodetointegrateeditorfunctionality.
ThisisnoticeableinthenewDiff(opened,forexample,byselectingasourcefileandchoosingSubversion>Diff).
Whenit'sshowingalocalfile,therightpaneiseditable,providingthefullsetofeditorfeatures–seman-tichighlightingandcodecompletionincluded.
ThenewDiffaddsotherinterestingtricks,likeone-clickmergingandword-leveldiff(ifasinglewordischangedinaline,onlythatwordishighlighted).
CheckouttheseimprovementsinFigure2.
YoucanalsoenableanInlineDifffeature,whichcreatesaDiffside-bar,highlightingupdatedsectionsofaversionedfile.
Thesidebarletsyouvisualizeorrollbackchanges,andopenthefullDiffview.
JavadochintsYoualwaysdocumentallyourcode,rightWell,ifyoudon't,Net-Beanswillcomplainaboutmissingandincorrectjavadoctags.
TheIDEcanhelpyouwithautomaticfixesthataddthemissingtags,onlyaskingyoutofillintheblanks.
Andwhileyou'redoingthat,youcanusethenewJavadocviewforconvenientpreviewing.
Javadoccheckingisactivebydefault,butit'snotintrusive:theedi-torwillreportmissingjavadoctagsjustfortheselectedline;onlyincorrecttagswillbereportedeverywhere.
YoucancustomizetheseandrelatedoptionsthroughTools|Options>JavaCode>Hints.
OtherfeaturesTheneweditoranditsframeworkincludeothergeneralfeatures,likereusableeditortabs.
Theseareusefulforthedebugger,toavoidclutteringyourenvi-ronmentwitheditorsopenedbybreakpointsorstep-into's.
There'salsoanewGenerateCodedialogthatautomatesthecreationofconstructors,gettersandsetters,equals()andhashCode(),anddelegatemethods.
RefactoringandJackpotNetBeans6.
0improvestheexistingrefac-toringsupportextensively.
Thereisanewinternallanguage-independentrefactoringAPIthatwillallowimplementingrefactoringsforcodeotherthancommon.
javasources(e.
g.
,XMLorJSFfiles).
ThenewAPIalsoallowsJavarefactoringstopreciselyupdatedependentnon-Javaelements.
Thisshouldmakethecurrentrefactoringssaferandeasiertouse.
Thebignewshere,though,isthebreak-throughnewtechnologyfromprojectJack-pot,whichhasbeenavailableforsometimebutisonlyreachingmaturitynow.
WithitsinclusioninNetBeans6.
0,JackpotwillbepromotedtoastandardfeatureandbemorecloselyintegratedwiththeIDE.
YoumayhaveheardthatJackpotisanewrefactoringtool,butthisreallydoesn'tmakeitjustice.
Jackpotisactu-allyacomprehensiveframeworkforgen-eralcodeunderstandingandmanipula-tion.
Youcanuseitasareplacementorfoundationforseveralkindsoffeatures:refactoringsupport,advancedsearchingandbrowsing,qualityinspection,macro-likeautomationofcomplexeditingtasks,andmore.
UsingJackpotBeforetakingamorein-depthlookatJack-pot,let'sshowhoweasyitistouse.
ThenewFigure2TheLocalHistoryandthenewDiff:editingcapability,semantichighlightingandword-leveldiff.
AIssueThreeNNetBeans6.
0:NewCoreFeaturesinDepth4A3AQueryandRefactorcommandwillshowadialoglikeFigure3,whereyoucanpickaJackpotqueryorqueryset.
Somequerieshaveoptionsthatyoucansettopreferredvalues.
ClickQuery,andanymatchesfortheselectedquerieswillappearinaviewthatdetailseachmatch.
Also,ifthequeryinvolvescodechanges,youcanpreviewandconfirmthesechangesbyclickingonaDoRefactoringbutton.
JackpotrulesJackpot'sfullpowercomesfromitsopen-ness.
ThisrequireslearninganewlanguagebutwhenyourealizeJackpot'sfullpotentialyouwillseethatthelearningcurvequicklypaysoff.
Forexample,hereisaJackpotquerythatdetectsaninefficientcodepattern–theuseofequals("")tocheckifaStringisempty–andrewritesthematchingcode:$s.
equals(s.
length()==0)::$sinstanceofjava.
lang.
String;Thesyntaxispattern=>replacement::condition,wherethe$characteridentifiesmeta-variablesthatwillbindtoanyJavaprogramelement(identifier,statement,operator,literal,etc.
).
Let'sanalyzeeachclause:1.
Thepattern$s.
equals("")matchesinvocationstotheequals()methodthatpassanemptystringasargument.
2.
TheconditionistheonlyoptionalpartofaruleinJackpot'srulelanguage,butit'sacriticalpartinthisparticularrule:$sinstanceofjava.
lang.
Stringmakessurethattheruleonlyfireswhen$sisaString.
That'sanimportantconstraint,sinceourruleisspe-cifictousesofjava.
lang.
String.
equals(),andnottojustanyimplementationofequals().
3.
Finally,thereplacement–($s.
length()==0)–re-writesthematchingcode.
There'salotofsophisticationbehindthisapparentlysimplebehavior.
Foronething,lookatJackpot'sinstanceofoperator.
ItwalksandquackslikeJava'sinstanceof,butit'snotthesamething.
Java'sinstanceofisaruntimeoperatorwhoseleft-handoperandisanobjectreference.
Jackpot'sinstanceof,however,isacom-pile-time(static)operator;itsleft-handoperandisanynodeoftheprogram'sAST.
BecauseJackpot–liketheneweditor–reliesonjavac'ssourceanalysisengine,it'sabletofullyattributealltypesintheprocessedcode.
Thisincludesthemostcomplexcases,likeinferredgenerictypes.
Othercodeanalysistoolsoftenresorttoheuristicsthatapproximatetypesbutmightfailtocalculatetypesforsomeex-pressions.
Youcouldeventrytodoourrefactoring(replacings.
equals("")bys.
length()==0)usingplainregularexpressions:searchfor(\w*)\.
equals\andreplaceitwith$1.
length()==0.
Butregexesarerigidanddumb;theywon'tEFigure3Jackpot'sQueryandRefactordialog.
AFigure4Jackpot'sRefactoringManager.
ACoreIDE10NNetBeansMagazineevenexcludetextthat'sinsidecommentsorstringliterals,andasimplelinebreakwillpreventdetection.
Thisisobviouslyastrawmanexample(othertools,likePMDandFindBugs,aremuchsmarterthanregexes–althoughnotuptojavac-likeprecision),butitshowsthevalueofsmartertools/features.
ThereareJackpotoperatorswithoutJavacounterparts,fromsimpleoneslikeisTrue(node),whichmatchesbooleanexpressionsthatcanstaticallybeproventoalwaysevaluatetotrue–tomorepowerfuloperatorslikeisSideEffectFree(node).
Thelattermatchesastatement,blockormethodthatdoesn'tmodifyanyvariableout-sideitsscope.
Again,suchdetectionsresembleexistingcodeinspectiontools,whichdetectproblemslike"deadcode".
ButJackpot'srelianceonthefulljavactechnologyresultsinfewerfalsepositivesindetec-tions,andhighersafetyinautomaticreplacements.
YoucanalsowriteJackpotqueriesinplainJava,usingJackpotAPIsandNetBeans'moduledevelopmentfeatures.
ThisisnecessaryforcomplexrulesthatgobeyondthecapabilitiesofJackpot'srulelanguage.
Butasthislanguageevolves,fewerandfewerqueriesshouldrequireimplementationinJava.
Performance,bytheway,isnotanissue:querieswrittenintheJackpotrulelanguageareconvertedtoJavaandexecuteascompiledcode.
Figure4showsJackpot'sRefactoringManager.
Thisconfigura-tiondialogallowsyoutoinspectallinstalledqueriesandorganizethemintoquerysets.
Youcanalsoimportnewqueries.
Ifyouwriteanewqueryscript,justclickImportandthenewquerywillbeavail-ableintheQueryandRefactordialog.
UsageandperspectivesJackpotshipswithalibraryofpredefinedqueries,containingmanyrulesforcodeclean-upanddetectionofcommonprogrammingmis-takesorcodeanti-patterns,aswellasmigrationofdeprecatedAPIusage.
AsIwritethis,JackpothasjustbeenintegratedintoNetBeans.
SowehaveahybridsystemwithJackpotco-existingwithtraditionalrefactoringandcodemanipulationfeatures.
Thismeansthatcom-mandslikeRenamemethodarestillimplementedintheold-fashionedway,eventhoughtheycouldbeimplementedbyaJackpotrule.
Thesameholdsforcodevalidations("hints")andtheirautomaticfixes.
Someofthisfunctionalitywillcertainlybere-E5AimplementedonJackpotinthefuture.
Also,becauseJackpotmakesthedevelopmentofsuchthingsmucheasier,youshouldexpectanincreasingnumberofrefactorings,vali-dationsandothercode-crunchingfeaturestobeaddedtotheIDE.
ExtendedAntandJUnitsupportAntsupportinNetBeans6.
0hasbeenup-datedtoAnt1.
7.
0,amajornewreleasethataddssuchfeaturesassupportforJSR223-compatiblescriptinglanguages.
There'salsoanewprogressindicatorforAntpro-cesses.
TheIDE'sJUnitsupportnowhandlestheannotation-driventestcasesofJUnit4.
OldJUnit3.
8testcasesarestillsupported.
Also,theprojectpropertieseditorisim-provedwithclasspathentriesspecifictounittests.
ProjectandbuildfeaturesEditingcodeisfundamental,butformostnon-trivialprojectsawell-structuredandpowerfulbuildsystemiscriticaltoo.
NetBeans'projectmanagementandbuildsystemwasimprovedwithmanynewfea-tures.
InadditiontoitsAntsupport,NetBeanscanopenandunderstandApacheMaven2projects.
ThoughthenewMaven-basedproj-Figure5MultipleConfigurationsandsupportforJavaWebStartinthenewProjectPropertiesdialog'sRunpage.
AIssueThreeN11NetBeans6.
0:NewCoreFeaturesinDepthectsupportisnotintendedtoreplaceAntprojectsanytimesoon,itwillbewelcometoMavenfansortoanybodyneedingtobuildaprojectthatrequiresMaven.
Also,nowyoucanspecifypackagesorclassestoexcludefromthesourcetree.
Thisisusefulforworkingwithlargeproj-ects,whenyou'renotinterestedinseeingorrunningalloftheircodeandapartialbuildisviable.
Ifyouhavemanycorrelatedprojects,youcanorganizethemintoProjectGroups,socertainoperationslikeopeningprojectscanbeappliedtothegroupasawhole.
AndifyouwriteJavaSEprojectswithmanyentrypoints(classeswithmain()methods),orwithcommand-lineparametersthatre-quirefrequenteditsoftheprojectproper-ties,theRunConfigurationsfeaturewillmakeyourlifeeasier.
Theprojectproper-ties'RunpageshowsanewConfigurationoption.
Eachconfigurationallowsyoutodefinethemainclass,argumentsandVMoptions,independentlyofotherconfigura-tions.
SeeanexampleinFigure5.
Furthermore,thenewJavaWebStartsup-portautomatesthecreationandmainte-nanceofJNLPfiles,andmakesiteasiertoruntestswithoutneedingabrowser.
IntheProjectProperties,checkApplication>WebStart>EnableWebStart,andoffyougo.
JavaWebStartsupportintegrateswiththeRunConfigurationsfeature,bycreatingaWebStartconfiguration.
SoyoucantestthesameprojectwithorwithoutJAWS.
VersioncontrolRobustversioncontrolisanessentialfea-ture,evenforsimpleprojectswrittenbyonedeveloperoveraweekend.
Foronething,it'scriticaltoenable"fearlessprogram-ming",e.
g.
usingtechniqueslikerefactoring(manualorautomatic)withoutworry.
NetBeans6.
0bringsplentyofnewsinthisareatoo.
CVSNetBeanshastraditionallysupportedtheCVSversioncontrolsys-temandthissupportwasalreadyexcellentinNetBeans5.
5.
Version6.
0addsseveralupdatesinusability,likeexportingadiffpatchoffilesselectedintheSearchview;anewcommandtoopenaspecificrevision,tagorbranch;andanimprovedhistorysearchfeaturewithnewSummaryandDiffviews.
Therearealsonewadvancedopera-tionslikechangingtheCVSrootanddoingapartialmerge.
SubversionThebiggestnewsformanyusers,though,issupportforthein-creasinglypopularSubversionversioncontrolsystem.
NetBeans6.
0isthefirstreleasetointegratecompletefirst-classsupportforSVN.
EventhoughNetBeans5.
5nowoffersaSubversionmoduleintheUpdateCenter,youreallywantversion6.
0ifyouareaheavySubversionuser.
LocalHistoryNomatterwhichVersionControlSystemyouprefer,you'lllovethenewLocalHistoryfeature,alreadydepictedinFigure2.
NetBeans6.
0automaticallykeepsaninternalhistoryofrecentchangestoprojectresources.
Everytimeyousaveafile,thisisregisteredasa"commit"ofanewversionofthefileinthelocalhistory.
Sofilechangesaretrackedwithfinegranularity–somewhatlikeapersis-tentundofeature.
Youcaninspectthe"versions"inthelocalhistoryanddiffthemagainstthecurrentfiles.
Bewarned,however,thatthisfeatureismostlyusefulforundoingmistakesthatescapetheeditor'sundocapacity,e.
g.
afterclosingtheeditororrestartingtheIDE.
Youcanthenreverttoapreviousstatethatyouhaven'tyetcommittedtoasaferVCSrepository,per-hapsbecausethenewcodewasstillroughanduntested.
TheLocalHistoryfeatureispowerfulandissometimesalifesaver,butit'snotafullreplacementforarealVCS.
DebuggingThedebuggerisofcourseamongthemostcriticalfeaturesofanIDE,andNetBeansisalreadyverycompleteinthisarea.
Sowhat'slefttoimprovein6.
0Firstoff,theJavaSE6releasecontainstwonbi.
netbeans.
orgThenewNetBeansInstaller.
Asofthiswriting,youmustfollowalinktoadirectorywhereyou'llnavigatetotheinstallerpageforaspecificbuildCoreIDE12NNetBeansMagazineimportantnewJVMdebuggingfeatureswhichrequireanupdatedde-buggertouse.
(ThedebuggersfromNetBeans5.
5orolderreleaseswon'tbenefitfromtheseevenifyourunthemontopofJavaSE6.
)TherearealsootherdebuggerimprovementsthatarenotdependentontheJREversion,soyou'llbenefitevenifyouarechainedtosomestone-ageJavaruntimelike5.
0or,heavensforbid,1.
4.
2.
ForcingreturnvaluesSupposeyou'resteppinganywhereinamethodandyou'dliketoforceittoreturnimmediatelyandproduceaspecificreturnvalue.
Thisisnowsupportedinthe6.
0debugger,lettingyoucheck"what-if"scenariosandreproducebugsmoreeasily.
Youwon'tneedhackslikepatchingthesourcecodewithreturnstatements(andhavingtounpatchitlater).
AsIwrite,thisfeatureisnotyetimplemented,butitshouldbebeforethefinalrelease.
ExpressionsteppingExpressionsteppingisanothersmarttimesaver.
Incomplexexpres-sionscontainingmethodcalls,youcanstepintoindividualinvoca-tions,andwhensuchacallreturnsyoucanseethereturnedvalueevenit'snotassignedtoanylocalvariable.
Younolongerhavetobreakexpressionsintosimplepartsandintroducetemporarylocalsforthesinglepurposeofhelpingdebugging.
Also,theLocalVariablesviewwillshowthevaluereturnedbyinvokedmethods.
ExpressionsteppingwillworkinanyJavaruntime,butshowingval-uesreturnedbyinvokedmethodsrequiresJavaSE6.
MultithreadingsupportAnothernewfeaturethat'sveryusefulisDebugcurrentthread:youcaninstructthedebuggersothatonlyagiventhreadwillstopinbreakpoints.
Thisiscrucialfordebuggingconcurrentapplicationsthathaveseveralthreadsrunningthecodeofinterest.
Sincewedevelopersarenotmultithreaded,we'reeas-ilyoverwhelmedwhensettingabreakpointcausesthedebuggertostoptwentythreadsatonce!
OtherfeaturesTherearealsogeneralimprovementstootherfeatures,likebetterhandlingofbrokenbreakpoints(e.
g.
withincor-rectconditions),andacommandtocopycallstackstotheclipboard.
6ANewProfilerfeaturesInNetBeans6.
0,theProfilerbecomespartofthecoredistribution,andthere'sarangeofimportantimprovements.
Betterperformance–Performanceisgoodanywherebutit'salwaysacriticalis-sueinprofilers.
TheNetBeansProfiler,whichderivesfromSun'sJFluidresearchproject,pioneeredanewtechnologythatallowspro-filingappsnearlyatfullspeedbydynami-callyinstrumentingcode.
Also,theProfileritselfshouldbefasttoanalyzeandpresentdatacollectedfromtheJVM–especiallyonlinedatathat'sconstantlyupdatedastheprogramruns.
ThenewreleaseimprovessignificantlytheperformanceoftheLiveRe-sultscategorizationanddrilldown,soyou'llfindyourselfusingthisfeaturemoreoften.
Classloadingtelemetry–TheVMTe-lemetryviewnowshowsthenumberofloadedclassestogetherwiththenumberofthreads.
Memorysnapshotcomparison–Yourapplicationhasamethodthat'ssuspectofleakingTakeheapsnapshotsbeforeandaf-terrunningitthendiffthetwosnapshots.
HeapWalker–Theultimatetoolforleakhuntingandanykindofmemoryallocationanalysis.
Youcanloadaheapdumpandvi-sualizethefullobjectgraphintheheap(seeFigure6).
Figure6TheProfiler'sHeapWalker,inspectingaparticularinstanceofBigInteger.
AIssueThreeN13NetBeans6.
0:NewCoreFeaturesinDepth2Incidentally,severalmenuoptionsweresim-plifiedinNetBeans6.
0;forinstance,JavaPlat-formManagerbecameJavaPlatforms.
Loadgeneration–TheProfilersupportsintegrationwithloadgenerationtools(cur-rentlyonlyApacheJMeterissupportedbutmoreistocome).
ProfilingPoints–Theseareaprofiler'sequivalentofdebuggerbreakpoints.
Youcandefineplacesinyoursourcecodewheretheprofilershouldstart/stoptheclock,resetprofilingresultsortakeasnap-shot.
TheProfilingPointsfeatureremovesmostbureaucraticprofilingwork:neveragainwillyouneedtosteporpausecodetogetsnapshotsincriticalevents;youalsowon'tneedtotweakcodetomeasurethelatencyofaregionthatdoesn'tcoincidewithafullmethod.
GUIandusabilityAnIDEshouldhaveabeautiful,efficientandproductiveGUIasmuchasanyotherapplication.
NetBeans6.
0makesnewstridesinthisdirection.
LinuxandSolarisuserswillcertainlywel-comethemuchimprovedGTKL&F,whichisnowactivatedbydefaultontheseplat-forms.
Theactivated-by-defaultpartde-pendsonSun'sJRE6Update1(orbetter),whichcontainsitsownshareofimportantGTKupdates.
NetBeanswillrespectallsettingsfromtheactiveGTKtheme.
ThenewNetBeansInstaller(NBI)makesinstallationeasierandfaster.
Inthedown-loadspage,youcanselectwhichpacksyouwant(e.
g.
Enterprise,Mobility).
Thenyou'llbeofferedacustominstallerthatincludesallchosenfeaturesandwillin-stalltheseinasinglego.
NBIisespeciallyconvenientforsystemadministratorsthatneedtoinstallthesameIDEconfigurationinmultiplemachines,andfortrainerswhooftenlandinunpreparedlaboratories.
NetBeansalsoincludesredesignedicons,andtheSDIwindow-ingoption(arelicfromancientNetBeansreleases)wasremoved.
Nowyouhaveundockable/floatingwindows.
Finally,intheQAfront,thenewReportExceptiontoolstreamlinesreportingofdetaileder-rordatatoNetBeans'developers,whiletheUIGesturesCollectorcansubmitdataaboutyourIDEusagepatterns.
Thisdataisusefulnotonlyforresearch,butalsotoimplementakindof"tipoftheday"hintsystemnotbasedonMath.
random().
Itestedthis,andtheNetBeansAnalyticssiteofferedmeatutorialaboutprofilingmultithreadedprograms,whichwashighlycorrelatedwiththetasksIhadbeenperforminginrecentdays.
MatisseandvisualwebdevelopmentThereareonlytwocoreIDEfeaturesI'mnotcoveringhere.
Bothareaward-winningtoolsandtopreasonsformanydevelopershav-ingmovedtoNetBeans:theMatissevisualeditor,andtheVisualWebPack.
NetBeans6.
0bringssignificantupdatestoboth.
ForMatisse,checkoutthearticle"UIDesigninNetBeans6.
0"inthisissue,whereyou'llfinddetailedinformationaboutwhat'snew.
Currently,themostimportantchangesintheVisualWebPackrefertoitsintegrationintotheNetBeanscore.
Actually,therewon'tbeanexternalWebPackfor6.
0.
TheIDEalreadyofferedsupportforwebapplicationdevelopment,soitwasalittleoddtohavesomeofthatinthecoreandtherestinanexternalPack.
Historically,thishappenedbecausetheWebPacktechnologywasoriginallydevel-opedasaseparateproduct(Sun'sJavaStudioCreator),whichwasbasedonaforkofaveryoldNetBeansversion.
Soitsimplementa-tionbecamepartiallyredundantwithNetBeans'webtooling.
Nowthischasmisclosedandtherewillbenomoreduplicatecodeoreffort.
ThemergeresultsinasimplerIDEforallusers:fromvisual-designloverstotag-writingdiehards.
Thereareseveralnewfeaturesintheintegratedwebtoolingbutaswewritetheyarestillunderheavydevelopment,soitwasn'tviabletocoverthenewfunctionalityinthisissue.
However,don'tmissthearticle"VisualWebApplicationDesignwithNetBeans"foranupdatedtutorialonthelaststableversion.
PluginManagerNetBeans'open,extensiblearchitectureisoneofitscoreadvan-tagesandit'salsoveryeasytouseandintegratewith.
YoumaybesurprisedthattheTools>UpdateManagerhasdisappeared,though.
CoreIDE14NNetBeansMagazine7AButjustlookagain,atTools>Plugins2,andyou'llseeFigure7.
ThenewUIunifiesandbetterorganizestheoldUpdateCenter(seetheUpdates,NewPlugins,DownloadedandSettingstabs),andalsotheoldmodulemanager(seetheInstalledtab).
Therearenewfea-turestoo:forexample,whenyouselectaplugin(likewedidfortheJMeterModuleinFigure7),aRequiredPluginsnodewillappearifapplicable;youcanexpandittoseeanydependenciesthatmustalsobeinstalled.
ConclusionsNetBeans6.
0comeswithamassivenumberofnewandimprovedfeaturesandcertainlydeservesthemajorversionbump.
IfNetBeans5.
5waswide,NetBeans6.
0isalsodeep.
Developersupgradingtothelat-estversionwillhavenotonlyextensivesupportforallkindsofJavadevelop-mentbutalsoabest-of-breedfeaturesetineveryimportantfunctionalityarea.
ManyNetBeanspowerusersmayhavegonethroughthisarticleandfoundfea-turesthatwerealreadyavailableforpre-viousversionsviaadditionalmodules.
FromseveraleditorenhancementstoRunConfigurations,totheLocalHistory,youcouldfindannbmfilethatwouldprovidesomelevelofsupportforyourneed.
However,youcannowjustinstallthecoreIDEandhaveallthesefeaturesoutofthebox–andthey'resuperior,morepolishedandbetterintegratedthanwhat'sprovidedthroughexternalmodules.
Thishappensofcoursewitheverynewrelease,butNetBeans6.
0makesaverynoticeableefforttocatchupwithitsRFEs,embracingalargenumberofimprovementsthatfirstsurfacedascontributionsfromthebroadercommunity.
Thiscanonlybeviewedasgreatnews,andasevidenceofaprojectthatmovesfastinthedirectionus-erswant.
COsvaldoPinaliDoederlein(opinali@gmail.
com)isasoftwareengineerandconsultant,workingwithJavasince1.
0beta.
He'sanindependentexpertfortheJCP,havingservedforJSR-175(JavaSE5),andisaTechnologyArchitectatVisionnaireInformatica.
OsvaldohasanMScinObjectOrientedSoftwareEngineering,isacontributingeditorforJavaMagazineandmaintainsablogatweblogs.
java.
net/blog/opinali.
Figure7ThenewPluginManager.
ACoreIDEWiththisthirdissue,NetBeansMagazineiscompletingitsfirstanniversary.
KudosandthankstotheNetBeansdevelopercommunityforenablingustospreadthewordevenmoreaboutthiswonderfulIDEandPlatform!
1Yearnetbeans.
org/community/magazinemagazineCoreNetBeans6.
0FeaturesKnowindepthwhat'scominginthenewreleaseIntroducingC/C++PackLeverageNetBeansfornativedevelopmentTheblueMarineProjectNetBeansPlatformdevelopmentintherealworldOpenOffice.
orgIntegrationCreateadd-onsandcomponentstointerfacewithOOoProjectSchliemannOpeningtheIDEtootherlanguagesMobilityPackinPracticeLearnthebasicsandreducedevicefragmentationNewUIDesignFeaturesUpgradeyourdesktopproductivitywithNetBeans6.
0VisualWebDevelopmentRapidwebapplicationdesignandimplementationMay.
2007Release6.
0.
JSF.
Matisse.
C/C++.
Mobility.
NetBeansPlatform.
ScriptingLanguagesmagazineReachOutwiththeIDEandPlatform
商家介绍:创梦云是来自国内的主机销售商,成立于2018年4月30日,创梦云前期主要从事免备案虚拟主机产品销售,现在将提供5元挂机宝、特惠挂机宝、香港云服务器、美国云服务器、低价挂机宝等产品销售。主打高性价比高稳定性挂机宝、香港云服务器、美国云服务器、香港虚拟主机、美国虚拟主机。官方网站:http://cmy0.vnetdns.com本次促销产品:地区CPU内存硬盘带宽价格购买地址香港特价云服务器1...
7月4日是美国独立日,大致就是国庆节的意思吧。hostodo今年提前搞了个VPS大促销活动,4款便宜VPS,相当于7折,续费不涨价,本次促销不定时,不知道有多少货,卖完为止。VPS基于KVM虚拟,NVMe阵列,1Gbps带宽,自带一个IPv4+/64 IPv6,solusvm管理,送收费版DirectAdmin授权,VPS在用就有效! 官方网站:https://www.hostodo.com ...
racknerd怎么样?racknerd商家最近促销三款美国便宜vps,最低只需要9.49美元,可以选择美国圣何塞、西雅图、纽约和芝加哥机房。RackNerd是一家成立于2019年的美国高性价比服务器商家,主要从事美国和荷兰数据中心的便宜vps、独立服务器销售!支持中文工单、支持支付宝和微信以及PayPal付款购买!点击直达:racknerd官方网站INTEL系列可选机房:加利福尼亚州圣何塞、芝加...
highlighter为你推荐
东软集团股份有限公司用户googlehttp500http://bb500.com 这个电影网站安全不?为什么?有人能告诉我吗?不懂的人表乱说浪费你我的时间谢谢德国iphone禁售令苹果手机禁售了 我想问问 这两天刚买的8p现在禁售了 我是赔手里了还是没啥事 是幸运的还是倒霉的新iphone也将禁售iPhone已停用,停用时间为多久?重庆网站制作请问重庆那一家网站制作公司资信度比较好?技术实力雄厚呢?yixingjia合家欢是一种什么东西?宜人贷官网宜信信用贷款上征信吗小型汽车网上自主编号申请请问各位大虾,如何在网上选车牌号?免费代理加盟哪有免费的代理可以做的?
虚拟主机提供商 冰山互联 荷兰服务器 kddi 特价空间 permitrootlogin NetSpeeder hnyd panel1 河南服务器 idc是什么 nerds 腾讯实名认证中心 卡巴斯基试用版 申请免费空间和域名 畅行云 服务器论坛 114dns 空间服务器 apnic 更多